Package org.apache.flex.abc.semantics

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


    void processMXMLEmbed(IMXMLEmbedNode node, Context context)
    {
        // push a reference to the asset class on the stack
        ICompilerProject project = getProject();
        ClassDefinition classDefinition = (ClassDefinition)node.getClassReference(project);
        Name className = classDefinition != null ? classDefinition.getMName(project) : null;
        if (getProject().getTargetSettings().getMxmlChildrenAsData())
            context.addInstruction(OP_pushtrue);

        context.addInstruction(OP_getlex, className);       
    }
View Full Code Here


            // mx.utils.XMLUtil.createXMLDocument(xmlString).firstChild
            FlexProject flexProject = (FlexProject)getProject();
            context.addInstruction(OP_getlex, flexProject.getXMLUtilClassName());
            context.addInstruction(OP_pushstring, node.getXMLString());
            context.addInstruction(OP_callproperty, CREATE_XML_DOCUMENT_CALL_OPERANDS);
            context.addInstruction(OP_getproperty, new Name("firstChild"));
        }

        // Traverse the children - these will be any MXMLBindingNode that were created for
        // databinding expressions inside the XML
        traverse(node, context);
View Full Code Here

     * an MXML Model, and is also the value of the Model's non-leaf properties.
     */
    private void pushModelClass(Context context)
    {
        FlexProject project = getProject();
        Name modelClassName = project.getModelClassName();
       
        // Push a new ObjectProxy.
        context.addInstruction(OP_findpropstrict, modelClassName);
        context.addInstruction(OP_constructprop, new Object[] { modelClassName, 0 });               
    }
View Full Code Here

        // because the child nodes can't be get code-gen'd in child order.
        for (String propertyName : node.getPropertyNames())
        {
            context.pushTarget();
            pushModelPropertyValue(node, propertyName, context);
            context.addInstruction(OP_setproperty, new Name(propertyName));
        }
    }
View Full Code Here

     * }
     * </pre>
     */
    private void overrideModuleFactorySetter(Context context)
    {
        final Name moduleFactoryName = new Name("moduleFactory");
        final IResolvedQualifiersReference styleManagerReference = ReferenceFactory.packageQualifiedReference(
                this.getProject().getWorkspace(),
                "mx.styles.StyleManagerImpl");
        final Name styleManagerReferenceName = styleManagerReference.getMName();

        final MethodInfo methodInfo = new MethodInfo();
        methodInfo.setMethodName("moduleFactory");
        methodInfo.setReturnType(NAME_VOID);
        methodInfo.setParamNames(ImmutableList.<String> of("factory"));

        final Vector<Name> paramTypes = new Vector<Name>();
        final Name flexModuleFactoryTypeName = new Name(
                new Namespace(ABCConstants.CONSTANT_PackageNs, "mx.core"),
                "IFlexModuleFactory");
        paramTypes.add(flexModuleFactoryTypeName);
        methodInfo.setParamTypes(paramTypes);
       
        final InstructionList methodInstructions = new InstructionList();
       
        // super.moduleFactory = factory;
        methodInstructions.addInstruction(ABCConstants.OP_getlocal0);
        methodInstructions.addInstruction(ABCConstants.OP_getlocal1);
        methodInstructions.addInstruction(ABCConstants.OP_setsuper, moduleFactoryName);
       
        // if (mfi)
        //     return;
        Label label1 = new Label();
        methodInstructions.addInstruction(OP_getlocal0);
        methodInstructions.addInstruction(OP_getproperty, NAME_MODULE_FACTORY_INITIALIZED);
        methodInstructions.addInstruction(OP_iffalse, label1);
       
        methodInstructions.addInstruction(OP_returnvoid);
        methodInstructions.labelNext(label1);

        // mfi = true;
        methodInstructions.addInstruction(OP_getlocal0);
        methodInstructions.addInstruction(OP_pushtrue);
        methodInstructions.addInstruction(OP_setproperty, NAME_MODULE_FACTORY_INITIALIZED);
       
        if (hasStyleSpecifiers || hasEffectSpecifiers)
        {
            FlexProject project = this.getProject();
            Name cssStyleDeclarationName = project.getCSSStyleDeclarationClassName();
           
            // Create an anonymous function from the style and effect-style specifiers
            // for the class definition tag. It will be set as the value of
            // styleDeclaration.defaultFactory.
            MethodInfo styleDeclarationDefaultFactory = createStyleDeclarationDefaultFactory(context);
           
            // if (this.styleDeclaration == null)
            //     this.styleDeclaration = new CSSStyleDeclaration(null, this.styleManager);
            Label label2 = new Label();
            methodInstructions.addInstruction(OP_getlocal0);
            methodInstructions.addInstruction(OP_getproperty, NAME_STYLE_DECLARATION);
            methodInstructions.addInstruction(OP_iftrue, label2);
   
            methodInstructions.addInstruction(OP_getlocal0);
            methodInstructions.addInstruction(OP_findpropstrict, cssStyleDeclarationName);
            methodInstructions.addInstruction(OP_pushnull);
            methodInstructions.addInstruction(OP_getlocal0);
            methodInstructions.addInstruction(OP_getproperty, NAME_STYLE_MANAGER);
            methodInstructions.addInstruction(OP_constructprop, new Object[] { cssStyleDeclarationName, 2} );
            methodInstructions.addInstruction(OP_setproperty, NAME_STYLE_DECLARATION);
            methodInstructions.labelNext(label2);
   
            // this.styleDeclaration.defaultFactory = <anonymous function>
            methodInstructions.addInstruction(OP_getlocal0);
            methodInstructions.addInstruction(OP_getproperty, NAME_STYLE_DECLARATION);
            methodInstructions.addInstruction(OP_newfunction, styleDeclarationDefaultFactory);
            methodInstructions.addInstruction(OP_setproperty, NAME_DEFAULT_FACTORY);
        }
       
        if (hasEffectSpecifiers)
        {
            // this.registerEffects([ ... ]);
            methodInstructions.addInstruction(OP_getlocal0);
            methodInstructions.addAll(context.get(IL.MODULE_FACTORY_EFFECTS));
            methodInstructions.addInstruction(OP_newarray, context.getCounter(IL.MODULE_FACTORY_EFFECTS));
            methodInstructions.addInstruction(OP_callpropvoid, REGISTER_EFFECTS_CALL_OPERANDS);
        }
       
        if (hasStyleTags)
        {
            // generateCSSStyleDeclarationsForComponents(super.styleManager, factoryFunctions, data);
            methodInstructions.addInstruction(ABCConstants.OP_getlex, styleManagerReferenceName);
            methodInstructions.addInstruction(ABCConstants.OP_getlocal0);
            methodInstructions.addInstruction(ABCConstants.OP_getsuper, NAME_STYLE_MANAGER);
            methodInstructions.addInstruction(ABCConstants.OP_getlex, CSSReducer.NAME_FACTORY_FUNCTIONS);
            methodInstructions.addInstruction(ABCConstants.OP_getlex, CSSReducer.NAME_DATA_ARRAY);
            methodInstructions.addInstruction(ABCConstants.OP_callproperty, new Object[] { NAME_GENERATE_CSSSTYLEDECLARATIONS, 3 });
        }
       
        // styleManager.initProtoChainRoots();
        methodInstructions.addInstruction(ABCConstants.OP_getlocal0);
        methodInstructions.addInstruction(ABCConstants.OP_getsuper, NAME_STYLE_MANAGER);
        methodInstructions.addInstruction(ABCConstants.OP_callpropvoid, new Object[] {new Name("initProtoChainRoots"), 0 });
        methodInstructions.addInstruction(ABCConstants.OP_returnvoid);
       
        generateMethodBody(methodInfo, classScope, methodInstructions);

        addSetter(moduleFactoryName, methodInfo, true);
View Full Code Here

         * For debugging only.
         * Generates a call to trace() in the current instruction list.
         */
        private void callTrace(String message)
        {
            Name trace = new Name("trace");
           
            addInstruction(OP_getlocal0);
            addInstruction(OP_pushscope);
           
            addInstruction(OP_findpropstrict, trace);
View Full Code Here

            {
                namespaceSet = null;
                nameKind = isAttributeIdentifier() ? CONSTANT_RTQnameA : CONSTANT_RTQname;
            }

            return new Name(nameKind, namespaceSet, getName());
        }

        Name name = null;

        if (isMemberRef())
        {
            ExpressionNodeBase baseExpr = getBaseExpression();
            if (baseExpr != null)
            {
                // Handle the case where we look like a member expression, but the base expression is really
                // a reference to a package.  For example 'a.b.c.Foo' where a.b.c is a known package name.
                // This needs to generate a QName with a.b.c as the qualifier.
                if (baseIsPackage())
                {
                    String packageName = baseExpr.computeSimpleReference();
                    Workspace workspace = (Workspace)project.getWorkspace();
                    INamespaceReference qualifier = workspace.getPackageNamespaceDefinitionCache().get(packageName, false);

                    return new Name(isAttributeIdentifier() ? CONSTANT_QnameA : CONSTANT_Qname,
                            new Nsset(qualifier.resolveAETNamespace(project)), getName());
                }

                Set<INamespaceDefinition> namespaceSet = null;
                IDefinition baseType = baseExpr.resolveType(project);
View Full Code Here

     */
    private static Name makeName(Set<INamespaceDefinition> namespaceSet, String name, boolean isAttr)
    {
        int nameKind = isAttr ? CONSTANT_MultinameA : CONSTANT_Multiname;
        Nsset nsSet = SemanticUtils.convertSetINamespaceToNsset(namespaceSet);
        Name n = new Name(nameKind, nsSet, name);
        return n;
    }
View Full Code Here

        final MethodInfo mi = startFunctionGeneration(f);
        if ( mi != null )
        {
            FunctionDefinition funcDef = f.getDefinition();
            Name funcName = funcDef.getMName(this.currentScope.getProject());
           
            SemanticUtils.checkScopedToDefaultNamespaceProblem(this.currentScope, f, funcDef, null);
           

            boolean conflictsWithOtherDefinition = false;
            if ( funcName == null )
            {
                //  getMName() emitted a diagnostic,
                //  repair and continue.
                funcName = new Name("<invalid>");
            }
            else
            {
                conflictsWithOtherDefinition = currentScope.getMethodBodySemanticChecker().checkFunctionForConflictingDefinitions(f, funcDef);
            }
View Full Code Here

        if ( var.hasModifier(ASModifier.STATIC))
        {
           
            ICompilerProject project = this.currentScope.getProject();

            Name var_name = varDef.getMName(project);

            TypeDefinitionBase typeDef = (TypeDefinitionBase)varDef.resolveType(project);
            Name var_type = typeDef != null ? typeDef.getMName(project) : null;
           
            //  It's not necessary to check for duplicates
            //  in the traits because that is a semantic error
            //  in this context.
            ITraitVisitor tv = this.currentScope.traitsVisitor.visitSlotTrait(ABCConstants.TRAIT_Const, var_name, ITraitsVisitor.RUNTIME_SLOT, var_type, LexicalScope.noInitializer);
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.