Package org.apache.flex.abc.semantics

Examples of org.apache.flex.abc.semantics.Name


     */
    private Name getInstanceInitializerName(IMXMLInstanceNode instanceNode)
    {
        // Check the map to see if an initializer name
        // has already been assigned to this instance node.
        Name name = instanceInitializerMap.get(instanceNode);
       
        // If so, return it.
        if (name != null)
            return name;
       
View Full Code Here


     */
    public Name getEventHandlerName(IMXMLEventSpecifierNode eventNode)
    {
        // Check the map to see if a handler name
        // has already been assigned to this event node.
        Name name = eventHandlerMap.get(eventNode);
       
        // If so, return it.
        if (name != null)
            return name;
       
        // Otherwise, generate the next one in the sequence ">0", ">1", etc.
        String baseName = EVENT_HANDLER_NAME_BASE + eventHandlerCounter++;
       
        // Either make the Name public or put it in the special
        // private namespace for APIs that are autogenerated.
        name = eventNode.needsPublicHandler() ?
               new Name(baseName) :
               createMXMLPrivateName(baseName);
       
        // Remember it in the map.
        eventHandlerMap.put(eventNode, name);
       
View Full Code Here

     */
    public Name getVectorGeneratorName(Name typeName)
    {
        // Check the map to see if a handler name
        // has already been assigned to this event node.
        Name name = VectorGeneratorMap.get(typeName);
       
        // If so, return it.
        if (name != null)
            return name;
       
View Full Code Here

            {
                transferWebServiceOperationsOrRemoteObjectMethods((IMXMLInstanceNode)node, childContext, parentContext);
            }
       
            IMXMLInstanceNode instanceNode = (IMXMLInstanceNode)childContext.node;          
            Name instanceClassName = childContext.instanceClassName;
           
            if (!getProject().getTargetSettings().getMxmlChildrenAsData() && generateNonDescriptorCode)
            {
                callInitialized(instanceNode, childContext);
                setDocument(instanceNode, true, childContext);
                setDocumentDescriptorForInstance(instanceNode, childContext);
            }
           
            String id = instanceNode.getEffectiveID();
            if (id != null)
            {
                Name idName = new Name(id);
               
                // Create a reference variable in the class whose name is the id.
                // For example, for <s:Button id="b1"/>, create
                // public var b1:spark.components.Button;
                if( instanceNode.getID() != null )
                {
                    IDefinition d = instanceNode.resolveID();
                    // Only create reference var if it isn't already declared on base class
                    // Look for a property with the same name as this function in the base class
                    // the lookup will search up the inheritance chain, so we don't have to worry about
                    // walking up the inheritance chain here.
                    ClassDefinition base = (ClassDefinition)classDefinition.resolveBaseClass(getProject());

                    if (base != null)
                    {
                        IDefinition baseDef = base.getContainedScope().getQualifiedPropertyFromDef(
                            getProject(), base, d.getBaseName(), NamespaceDefinition.getPublicNamespaceDefinition(), false);
                        if (baseDef == null)
                            addBindableVariableTrait(idName, instanceClassName, d);
                        //else
                        //    System.out.println("not adding bindable variable trait for " + d.getBaseName() + " in " + instanceClassName);
                    }
                    else
                        addBindableVariableTrait(idName, instanceClassName, d);
                }
                else
                {
                    // No ID specified, can just make a var that isn't bindable
                    addVariableTrait(idName, instanceClassName);
                }

                if (!getProject().getTargetSettings().getMxmlChildrenAsData())
                {
                    if (generateNonDescriptorCode || isStateDependentInstance(instanceNode))
                    {
                        // Set the reference variable to the new instance.
                        setIDReferenceVariable(idName, childContext);
                       
                        if (instanceAffectsBindings(instanceNode))
                        {
                            // Call executeBindings() on the new instance.
                            executeBindingsForInstance(instanceNode, childContext);
                        }
                    }
                }
            }
           
            if (getProject().getTargetSettings().getMxmlChildrenAsData())
            {
                return;
            }           
                       
            Name initializerName = null;
                      
            if (isInitializer)
            {
                initializerName = getInstanceInitializerName(instanceNode);
                MethodInfo methodInfo = createInstanceInitializerMethodInfo(
                    initializerName.getBaseName(), instanceClassName);
                addMethodTrait(initializerName, methodInfo, false);
   
                childContext.addInstruction(OP_returnvalue);
                generateMethodBody(methodInfo, classScope, childContext.currentInstructionList);
            }
View Full Code Here

        boolean newCodeGen = getProject().getTargetSettings().getMxmlChildrenAsData();

        traverse(node, context, MXML_SPECIFIER_NODES);

        // Construct DesignLayer instance in the context's mainInstructionList.
        final Name instanceClassName = context.instanceClassName;
        context.addInstruction(OP_findpropstrict, instanceClassName);
        context.addInstruction(OP_constructprop, new Object[] {instanceClassName, 0});
        int numElements = setSpecifiers(context, newCodeGen, false);
        numElements++;  // for pushing the class
        if (!newCodeGen)
View Full Code Here

    Name generateVectorGenerator(Name typeName, IMXMLVectorNode vectorNode)
    { 
        // Event nodes (including state-dependent ones)
        // generate a new event handler method.
        // Create a MethodInfo and a method trait for the handler.
        Name name = getVectorGeneratorName(typeName);
        MethodInfo methodInfo = createVectorGeneratorMethodInfo(
            getProject(), vectorNode, name.getBaseName());
        addMethodTrait(name, methodInfo, false);
       
        ICompilerProject project = getProject();
        ASProjectScope projectScope = (ASProjectScope)project.getScope();
        IDefinition vectorDef = projectScope.findDefinitionByName(IASLanguageConstants.Vector_qname);
        Name vectorName = ((ClassDefinition)vectorDef).getMName(project);

        InstructionList generatorFunctionBody = new InstructionList();
        generatorFunctionBody.addInstruction(OP_getlocal0);
        generatorFunctionBody.addInstruction(OP_pushscope);
        // Synthesize the class Vector.<T>.
View Full Code Here

            type = ((IAppliedVectorDefinition)(vectorNode.getType())).resolveElementType(project);
        boolean fixed = vectorNode.getFixed();
               
        ASProjectScope projectScope = (ASProjectScope)project.getScope();
        IDefinition vectorDef = projectScope.findDefinitionByName(IASLanguageConstants.Vector_qname);
        Name vectorName = ((ClassDefinition)vectorDef).getMName(project);
        Name typeName = ((TypeDefinitionBase)type).getMName(project);
        Nsset nsSet = new Nsset(new Namespace(ABCConstants.CONSTANT_PackageNs));
        Name indexName = new Name(ABCConstants.CONSTANT_MultinameL, nsSet, null);
       
        if (getProject().getTargetSettings().getMxmlChildrenAsData())
        {
            context.addInstruction(OP_getlex, typeName); // push the type so decoders have a hint
            Name vectorGenerator = generateVectorGenerator(typeName, vectorNode);
            context.addInstruction(OP_getlocal0);
            context.addInstruction(OP_getproperty, vectorGenerator);
           
            context.makingArrayValues = true;
            // Set each element of the vector.
View Full Code Here

            }
           
            if (generateNonDescriptorCode(instanceNode, context) || context.instanceHasOwnInitializer)
            {
                // Construct the new instance in the context's mainInstructionList.
                Name instanceClassName = context.instanceClassName;
                context.addInstruction(OP_findpropstrict, instanceClassName);
                context.addInstruction(OP_constructprop, new Object[] { instanceClassName, 0 });
               
                // Set its properties, styles, events, and effects.
                setSpecifiers(context);
View Full Code Here

            return;
       
        FlexProject project = getProject();
       
        // Get the Name for the mx.binding.BindingManager class.
        Name bindingManagerName = project.getBindingManagerClassName();
       
        // Get the id (possibly a generated one) for the instance.
        String id = instanceNode.getEffectiveID();
        if (id == null)
            return;
View Full Code Here

            context.addInstruction(OP_pushtrue);
       
        // Get the Name for the mx.core.ClassFactory class.
        ICompilerProject project = getProject();
        ClassDefinition classReference = (ClassDefinition)factoryNode.getClassReference(project);
        Name factoryClassName = classReference != null ? classReference.getMName(project) : null;
       
        // Push this class.
        context.addInstruction(OP_finddef, factoryClassName);
       
        // Push the class to be used as the generator,
View Full Code Here

TOP

Related Classes of org.apache.flex.abc.semantics.Name

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.