Package org.apache.flex.compiler.tree.as

Examples of org.apache.flex.compiler.tree.as.IClassNode


        // we don't want 'var self = this;' in FlexJS
    }

    private boolean writeThis(IIdentifierNode node)
    {
        IClassNode classNode = (IClassNode) node
                .getAncestorOfType(IClassNode.class);

        IDefinition nodeDef = ((IIdentifierNode) node).resolve(project);

        IASNode parentNode = node.getParent();
View Full Code Here


            }

            if (parentNode.getNodeID() == ASTNodeID.MemberAccessExpressionID
                    && parentNode.getChild(0).getNodeID() == ASTNodeID.SuperID)
            {
                IClassNode cnode = (IClassNode) node
                        .getAncestorOfType(IClassNode.class);

                write(cnode.getQualifiedName());
                write(ASEmitterTokens.MEMBER_ACCESS);
                write(JSGoogEmitterTokens.GOOG_BASE);
                write(ASEmitterTokens.PAREN_OPEN);
                write(ASEmitterTokens.THIS);
                writeToken(ASEmitterTokens.COMMA);
View Full Code Here

        }

        if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
            return;

        IClassNode cnode = (IClassNode) node
                .getAncestorOfType(IClassNode.class);

        write(cnode.getQualifiedName());
        write(ASEmitterTokens.MEMBER_ACCESS);
        write(JSGoogEmitterTokens.GOOG_BASE);
        write(ASEmitterTokens.PAREN_OPEN);
        write(ASEmitterTokens.THIS);
View Full Code Here

                    if (mnode.getLeftOperandNode().getNodeID() == ASTNodeID.SuperID)
                    {
                        IIdentifierNode lnode = (IIdentifierNode) mnode
                                .getRightOperandNode();

                        IClassNode cnode = (IClassNode) node
                                .getAncestorOfType(IClassNode.class);

                        initializeInheritenceLevel(cnode.getDefinition());

                        // super.foo();
                        write("this.");

                        write(lnode.getName() + "$" + inheritenceLevel);
View Full Code Here

    @Override
    public void emitIdentifier(IIdentifierNode node)
    {
        ICompilerProject project = getWalker().getProject();

        IClassNode cnode = (IClassNode) node
                .getAncestorOfType(IClassNode.class);

        IDefinition def = ((IIdentifierNode) node).resolve(project);

        ITypeDefinition type = ((IIdentifierNode) node).resolveType(project);

        IASNode pnode = node.getParent();
        ASTNodeID inode = pnode.getNodeID();

        boolean writeSelf = false;
        if (cnode != null)
        {
            IDefinitionNode[] members = cnode.getAllMemberNodes();
            for (IDefinitionNode mnode : members)
            {
                if ((type != null && type.getQualifiedName().equalsIgnoreCase(
                        IASLanguageConstants.Function))
                        || (def != null && def.getQualifiedName()
                                .equalsIgnoreCase(mnode.getQualifiedName())))
                {
                    if (!(pnode instanceof FunctionNode)
                            && inode != ASTNodeID.MemberAccessExpressionID)
                    {
                        writeSelf = true;
                        break;
                    }
                    else if (inode == ASTNodeID.MemberAccessExpressionID
                            && !def.isStatic())
                    {
                        String tname = type.getQualifiedName();
                        writeSelf = !tname.equalsIgnoreCase(cnode
                                .getQualifiedName())
                                && !tname.equals(IASLanguageConstants.Function);
                        break;
                    }
                }
            }
        }

        boolean isRunningInTestMode = cnode != null
                && cnode.getQualifiedName().equalsIgnoreCase("FalconTest_A");
        if (writeSelf && !isRunningInTestMode)
        {
            write(JSGoogEmitterTokens.SELF);
            write(ASEmitterTokens.MEMBER_ACCESS);
        }
        else
        {
            String pname = (type != null) ? type.getPackageName() : "";
            if (cnode != null
                    && pname != ""
                    && !pname.equalsIgnoreCase(cnode.getPackageName())
                    && inode != ASTNodeID.ArgumentID
                    && inode != ASTNodeID.VariableID
                    && inode != ASTNodeID.TypedExpressionID)
            {
                write(pname);
View Full Code Here

        }

        if (fnode.isConstructor() && !hasSuperClass(fnode))
            return;

        IClassNode cnode = (IClassNode) node
                .getAncestorOfType(IClassNode.class);

        write(cnode.getQualifiedName());
        write(ASEmitterTokens.MEMBER_ACCESS);
        write(JSGoogEmitterTokens.GOOG_BASE);
        write(ASEmitterTokens.PAREN_OPEN);
        write(ASEmitterTokens.THIS);
View Full Code Here

        return (ITypeDefinition) tnode.getDefinition();
    }

    protected static IClassDefinition getClassDefinition(IDefinitionNode node)
    {
        IClassNode tnode = (IClassNode) node
                .getAncestorOfType(IClassNode.class);
        return (tnode != null) ? tnode.getDefinition() : null;
    }
View Full Code Here

    {
        IScopedNode scope = node.getContainingScope();
        if (scope instanceof IMXMLDocumentNode)
            return ((IMXMLDocumentNode) scope).getClassDefinition();

        IClassNode cnode = (IClassNode) node
                .getAncestorOfType(IClassNode.class);
        return cnode.getDefinition();
    }
View Full Code Here

        IFileNode node = (IFileNode) getNode(
                "public class B { public function c() { this.b = 1; }; public function set b(value:int):void {}}",
                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
                node, IFunctionNode.class);
        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
                node, IClassNode.class);
        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                fnode, IBinaryOperatorNode.class);
        ((NodeBase)fnode).setParent(null);
        IDefinition def = classnode.getDefinition();

        ((JSFlexJSEmitter)asEmitter).thisClass = def;
        asBlockWalker.visitBinaryOperator(bnode);
        assertOut("this.set_b(1)");
    }
View Full Code Here

        IFileNode node = (IFileNode) getNode(
                "public class B { public function c() { b = 1; }; public function set b(value:int):void {}}",
                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
                node, IFunctionNode.class);
        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
                node, IClassNode.class);
        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                fnode, IBinaryOperatorNode.class);
        ((NodeBase)fnode).setParent(null);
        IDefinition def = classnode.getDefinition();

        ((JSFlexJSEmitter)asEmitter).thisClass = def;
        asBlockWalker.visitBinaryOperator(bnode);
        assertOut("this.set_b(1)");
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.tree.as.IClassNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.