Package org.apache.flex.compiler.definitions

Examples of org.apache.flex.compiler.definitions.IDefinition


             ancestor != null;
             ancestor = ancestor.getParent())
        {
            if (ancestor instanceof IDefinitionNode)
            {
                IDefinition definition = ((IDefinitionNode)ancestor).getDefinition();
                if (definition.isDeprecated())
                    return true;
            }
        }
       
        return false;
View Full Code Here


    {
        FunctionDefinition func_def = SemanticUtils.getFunctionDefinition(iNode);

        if ( func_def != null )
        {
            IDefinition return_type = func_def.resolveReturnType(project);
            //  The function must return a value unless its return type is void or *,
            //  or if it's a constructor (its definition lies).
            return !(
                return_type == null ||
                return_type.equals(ClassDefinition.getVoidClassDefinition()) ||
                return_type.equals(ClassDefinition.getAnyTypeClassDefinition()) ||
                func_def.isConstructor()
            );
        }
        else
        {
View Full Code Here

    @Override
    public ASTNodeID getNodeID()
    {
        ASTNodeID nodeID = ASTNodeID.VariableID;

        IDefinition varDef = this.getDefinition();
        if (varDef != null && varDef.isBindable())
        {
            // Bindable vars with a user-specified event class work the same as normal variables
            // the user is responsible for dispatching the event.
            List<String> eventNames = varDef.getBindableEventNames();
            if (eventNames.size() == 0)
                nodeID = ASTNodeID.BindableVariableID;
        }

        return nodeID;
View Full Code Here

    //

    @Override
    public String getVariableType()
    {
        IDefinition definition = getDefinition();
       
        List<IVariableTypeDecorator> list = SymbolDecoratorProvider.getProvider().getVariableTypeDecorators(definition);
        if (list.size() > 0)
        {
            Iterator<IVariableTypeDecorator> it = list.iterator();
            while (it.hasNext())
            {
                IDefinition type = it.next().decorateVariableType(definition);
                if (type != null)
                    return type.getQualifiedName();
            }
        }

        return super.getVariableType();
    }
View Full Code Here

        IASScope iscope = scopedNode.getScope();
        ASScope scope = (ASScope)iscope;
       
        if (ref == null)
            assert false;
        IDefinition def = ref.resolve(project, scope, DependencyType.EXPRESSION, false);
        if (def == null)
            assert false;
    }
View Full Code Here

                // 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);
View Full Code Here

            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);
View Full Code Here

        if (type instanceof IAppliedVectorDefinition)
            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);
       
View Full Code Here

            }
            else
            {
                if (!isDataboundProp(propertyNode))
                {
                    IDefinition propDef = propertyNode.getDefinition();
                    if (propDef.isPublic())
                    {
                        context.startUsing(IL.PROPERTIES);
                       
                        context.addInstruction(OP_pushstring, propertyName);
                       
                        context.isContentFactory = false;
                       
                        traverse(propertyNode, context);
                       
                        context.stopUsing(IL.PROPERTIES, 1);
                    }
                    else
                    {
                        Context tempContext = new Context(classDefinitionNode, iinitForNonPublicProperties);
                        tempContext.nonPublic = true;
                       
                        // Push the object on which the property is to be set.
                        tempContext.pushTarget();
                       
                        // Push the property value.
                        // Do this by codegen'ing sole child, which is an IMXMLInstanceNode.
                        traverse(propertyNode, tempContext);
                       
                        Name n = ((DefinitionBase)propDef).getMName(getProject());
                        tempContext.addInstruction(OP_setproperty, n);
                    }
                }
                else
                {
                    IMXMLInstanceNode instanceNode = propertyNode.getInstanceNode();
                    if (instanceNode instanceof IMXMLSingleDataBindingNode)
                        processMXMLDataBinding((IMXMLSingleDataBindingNode)instanceNode, context);
                    else if (instanceNode instanceof IMXMLConcatenatedDataBindingNode)
                        processMXMLConcatenatedDataBinding((IMXMLConcatenatedDataBindingNode)instanceNode, context);
                }
            }
            return;
        }
       
        boolean isDb = isDataboundProp(propertyNode);

        if (generateDescriptorCode(propertyNode, context))
        {
            if (!isDb)
            {
                context.startUsing(IL.DESCRIPTOR_PROPERTIES);
               
                context.addInstruction(OP_pushstring, propertyName);
               
                traverse(propertyNode, context);
               
                context.stopUsing(IL.DESCRIPTOR_PROPERTIES, 1);
            }
            else
            {
                IMXMLInstanceNode instanceNode = propertyNode.getInstanceNode();
                if (instanceNode instanceof IMXMLSingleDataBindingNode)
                    processMXMLDataBinding((IMXMLSingleDataBindingNode)instanceNode, context);
                else if (instanceNode instanceof IMXMLConcatenatedDataBindingNode)
                    processMXMLConcatenatedDataBinding((IMXMLConcatenatedDataBindingNode)instanceNode, context);
            }
        }
       
        if (generateNonDescriptorCode(propertyNode, context))
        {
            context.startUsing(IL.PROPERTIES);
           
            if (propertyNode.getParent().getNodeID() == ASTNodeID.MXMLObjectID)
            {
                // TODO This case presuambly also needs
                // some logic involving isDb.
               
                // Push the property name.
                context.addInstruction(OP_pushstring, propertyName);
               
                // Push the property value.
                // Do this by codegen'ing sole child, which is an IMXMLInstanceNode.
                traverse(propertyNode, context);
            }
            else
            {
                // Push the object on which the property is to be set.
                if (!isDb)
                    context.pushTarget();
               
                // Push the property value.
                // Do this by codegen'ing sole child, which is an IMXMLInstanceNode.
                traverse(propertyNode, context);
               
                // Set the property.
                // unless it's a databinding, then the property is set indiretly
               if (!isDb)
               {
                   IDefinition def = propertyNode.getDefinition();
                   Name n = ((DefinitionBase)def).getMName(getProject());
                   context.addInstruction(OP_setproperty, n);
               }
            }
           
View Full Code Here

        // Resolve the outer document, and if it doesn't resolve to the contingent
        // definition, that means there is already an existing definition declared
        // which is an error.
        ClassDefinition componentClass = (ClassDefinition)node.getContainedClassDefinition();
        ASScope classScope = componentClass.getContainedScope();
        IDefinition outerDocument = classScope.getPropertyFromDef(
            getProject(), componentClass, IMXMLLanguageConstants.PROPERTY_OUTER_DOCUMENT, false);
        assert (outerDocument != null) : "outerDocument should never be null, as always added";
        if (!outerDocument.isContingent())
        {
            ICompilerProblem problem = new MXMLOuterDocumentAlreadyDeclaredProblem(outerDocument);
             getProblems().add(problem);
        }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.definitions.IDefinition

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.