Examples of IASNode


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

            {
                int n = script.getChildCount();
                asNodes = new IASNode[n];
                for (int i = 0; i < n; i++)
                {
                    IASNode child = script.getChild(i);
                    asNodes[i] = child;
                    ((NodeBase)child).setParent(this);
                }
            }
        }
View Full Code Here

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

        }
       
        // now, process all the state dependent nodes
       
        int instanceNodeCounter = 0;
        IASNode anInstanceNode = null;
        for   (IMXMLNode node : stateDependentNodes)
        {
             // here we only care about instance nodes
            if (node instanceof IMXMLInstanceNode)
            {
                anInstanceNode = node;
                // Generate a map that tell for each state dependent instance node, what slot
                // it corresponds to in the array of
                // deferredInstanceFromFunction's
                if (nodeToIndexMap==null)     
                    nodeToIndexMap = new HashMap<IMXMLNode, Integer>();
                nodeToIndexMap.put(node, instanceNodeCounter);
                ++instanceNodeCounter; 
               
                InstructionList il;
                if (getProject().getTargetSettings().getMxmlChildrenAsData())
                {
                    if (nodeToInstanceDescriptorMap==null)     
                        nodeToInstanceDescriptorMap = new HashMap<IMXMLNode, InstructionList>();
                    il = new InstructionList();
                    nodeToInstanceDescriptorMap.put(node, il);
                    // build the initializer function by processing the node
                    Context stateContext = new Context((IMXMLInstanceNode)node, il);
                    stateContext.isContentFactory = true;
                    processNode(node, stateContext);
                    stateContext.transfer(IL.MXML_CONTENT_FACTORY);
                    stateContext.addInstruction(OP_newarray, stateContext.getCounter(IL.MXML_CONTENT_FACTORY));     
                }
                else
                {
                    context.addInstruction(OP_findpropstrict, deferredInstanceFromFunctionName)
                    // stack: ..., DeferredInstaceFromFunction class
                   
                    // build the initializer function by processing the node
                    processNode(node, context);
                    // stack: ..., DeferredInstaceFromFunction class, initializerFunc
                   
                    context.addInstruction(OP_constructprop, new Object[] { deferredInstanceFromFunctionName, 1});  
                    // stack: ..., DeferredInstaceFromFunction object
                }
            }
        }
       
        if (getProject().getTargetSettings().getMxmlChildrenAsData())
            return;

        // if we didn't find any state dependent instance nodes, then leave
        if (instanceNodeCounter==0)
            return;
               
        // stack: ..., arg[0], arg[1],.., arg[n-1]
        context.addInstruction(OP_newarray, instanceNodeCounter);
        context.addInstruction(OP_setlocal3);
       
        // now local3= array of deferredInstanceFromFunctionName
       
        // make a dependency on the sdk class DeferredInstanceFromFunction
        IWorkspace workspace = project.getWorkspace();
        IResolvedQualifiersReference ref = ReferenceFactory.packageQualifiedReference(workspace, deferredInstanceFromFunctionClass);
      
        IScopedNode scopedNode = anInstanceNode.getContainingScope();
        IASScope iscope = scopedNode.getScope();
        ASScope scope = (ASScope)iscope;
       
        if (ref == null)
            assert false;
View Full Code Here

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

     */
    void traverse(IASNode node, Context context, Predicate<IASNode> filter)
    {
        for (int i = 0; i < node.getChildCount(); i++)
        {
            final IASNode child = node.getChild(i);
           
            // Skip MXML nodes that have been marked as invalid for code generation.
            if (child instanceof IMXMLNode &&
                !((IMXMLNode)child).isValidForCodeGen())
            {
View Full Code Here

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

            !((IMXMLInstanceNode)node).isDeferredInstantiationUIComponent())
        {
            return true;
        }
           
        IASNode parent = node.getParent();      
        if (parent != null && parent instanceof IMXMLClassReferenceNode)
            return !((IMXMLClassReferenceNode)parent).isContainer();
        else
            return true;
    }
View Full Code Here

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

            // 1. Instance tags that are children of a <Declarations> tag.
            // 2. Non-visual instance tags that are children
            // of a class definition tag (as allowed in MXML 2006).
            if (generateNonDescriptorCode)
            {
                IASNode parent = node.getParent();
               
                if (parent instanceof IMXMLDeclarationsNode ||
                    parent instanceof IMXMLClassDefinitionNode &&
                    ((IMXMLInstanceNode)node).isDeferredInstantiationUIComponent())
                {
View Full Code Here

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

        context.addInstruction(OP_setproperty, idName);   // ... instance
    }
   
    boolean isDataBound(IMXMLExpressionNode node)
    {
        IASNode n = node.getExpressionNode();
        return n == null || isDataBindingNode(n);
    }
View Full Code Here

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

        {
            callInitialized(node, context);

            for (int i = 0; i < node.getChildCount(); i++)
            {
                final IASNode child = node.getChild(i);
                if (child instanceof IMXMLDesignLayerNode)
                {
                    // Call temp.addLayer(child) if there's a DesignLayer node in the direct children.
                    final IMXMLDesignLayerNode designLayerChildNode = (IMXMLDesignLayerNode)child;
                    if (!designLayerChildNode.skipCodeGeneration())
View Full Code Here

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

                    context.addInstruction(OP_pushnull); // array of descriptors
                else if (!context.parentContext.makingSimpleArray)
                {                   
                    for (int i = 0; i < arrayNode.getChildCount(); i++)
                    {
                        final IASNode child = arrayNode.getChild(i);
                        ASTNodeID nodeID = child.getNodeID();
                        if (nodeID == ASTNodeID.MXMLArrayID || nodeID == ASTNodeID.MXMLInstanceID)
                        {
                            isSimple = false;
                            break;
                        }
                    }
                    context.makingArrayValues = true;
                    context.makingSimpleArray = isSimple;
                    context.addInstruction(isSimple ? OP_pushtrue : OP_pushnull); // arrays are simple values     
                }
            }
        }

        traverse(arrayNode, context);
       
        // TODO: can we do better?
        // Now that stack will have the array children on it.
        // But we may not have created one for every child of arrayNode.
        // It would be best if we could remember how many we created, but
        // we can't easily do that. So we use our "knowledge" that children
        // are always created unless they are state dependent instances.
        int nMax = arrayNode.getChildCount();
        int numStateDependentChildren=0;
        for (int i=0; i<nMax; ++i)
        {
            IASNode ch = arrayNode.getChild(i);
            if (isStateDependentInstance(ch))
            {
                ++numStateDependentChildren;
            }
        }
View Full Code Here

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

    private static int getChildCountAfterFlattenDesignLayers(IASNode node)
    {
        int result = 0;
        for (int i = 0; i < node.getChildCount(); i++)
        {
            final IASNode child = node.getChild(i);
            if (child instanceof IMXMLDesignLayerNode)
            {
                result += ((IMXMLDesignLayerNode)child).getHoistedChildCount();
            }
            // IFilter out mxml script nodes which can get in here
View Full Code Here

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

    protected static boolean instanceAffectsBindings(IMXMLInstanceNode instanceNode)
    {
        int numChildren = instanceNode.getChildCount();
        for (int i = 0; i < numChildren; i++)
        {
            final IASNode child = instanceNode.getChild(i);
            if (child instanceof IMXMLPropertySpecifierNode)
            {
                IMXMLPropertySpecifierNode propertyNode = (IMXMLPropertySpecifierNode)child;
                if (isDataBindingNode(propertyNode.getInstanceNode()))
                    return true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.