Package org.apache.flex.compiler.internal.definitions

Examples of org.apache.flex.compiler.internal.definitions.VariableDefinition


     */
    DefinitionBase buildDefinition()
    {
        String definitionName = nameNode.computeSimpleReference();

        VariableDefinition definition;
        definition = isConst() ?
                     new ConstantDefinition(definitionName) :
                     new VariableDefinition(definitionName);

        fillinDefinition(definition);

        definition.setDeclaredInControlFlow(isInControlFlow());

        definition.setInitializer(this.getAssignedValueNode());

        return definition;
    }
View Full Code Here


        final DefinitionBase def;       
        kind &= ABCConstants.TRAIT_KIND_MASK;
        switch (kind)
        {
            case ABCConstants.KIND_SLOT:
                def = new VariableDefinition(definitionName, slot_value);
                break;
            case ABCConstants.KIND_CONST:
                if (slot_value instanceof Namespace)
                    def = NamespaceDefinition.createNamespaceDefinition(definitionName, (Namespace)slot_value);
                else
View Full Code Here

    @Override
    void declareVariable(VariableNode var)
    {
        verifyVariableModifiers(var);

        VariableDefinition varDef = (VariableDefinition)var.getDefinition();

        boolean is_static = var.hasModifier(ASModifier.STATIC);
        boolean is_const =  SemanticUtils.isConst(var, classScope.getProject());
       
        final ICompilerProject project = this.classScope.getProject();
       
        ICodeGenerator codeGenerator = classScope.getGenerator();
        IExpressionNode assignedValueNode = var.getAssignedValueNode();
        IConstantValue constantValue = codeGenerator.generateConstantValue(assignedValueNode, project);

        //  initializer is null if no constant value
        //  can be generated, and null is the correct value for "no value."
        Object initializer = constantValue != null ? constantValue.getValue() : null;
       
        // Reducing the constant value may have produced problems in the
        // LexicalScope used for constant reduction. Transfer them over
        // to the LexicalScope for this class.
        Collection<ICompilerProblem> problems = constantValue != null ? constantValue.getProblems() : null;
        if (problems != null)
            classScope.addProblems(problems);
       
        final MethodBodySemanticChecker checker = new MethodBodySemanticChecker(this.classScope);
       
        DefinitionBase varType = (DefinitionBase)varDef.resolveType(project);
       
        Object transformed_initializer = null;
       
        if ((initializer != null) && (varType != null))
        {
View Full Code Here

        // If we see a tag like <s:Button id="b">, add a VariableDefinition
        // to the class scope, corresponding to the ActionScript code
        //    [Bindable]
        //    public var b:spark.components:Button;
        VariableDefinition variableDefinition = new VariableDefinition(id);
        variableDefinition.setPublic();
        variableDefinition.setTypeReference(typeRef);
        variableDefinition.setNameLocation(idAttribute.getValueStart(), idAttribute.getValueEnd());
        variableDefinition.setBindable();
        currentClassScope.addDefinition(variableDefinition);
    }
View Full Code Here

        {
            // Add the arguments Array to the function scope
            // only do this if there is not already a local property, or parameter that is named arguments
            // and something in the function body references arguments - this should avoid creating the
            // definition when it's not needed.
            VariableDefinition argumentsDef = new VariableDefinition(IASLanguageConstants.arguments);
            argumentsDef.setNamespaceReference(NamespaceDefinition.getDefaultNamespaceDefinition(funcScope));
            argumentsDef.setTypeReference(ReferenceFactory.builtinReference(IASLanguageConstants.BuiltinType.ARRAY));

            argumentsDef.setImplicit();

            funcScope.addDefinition(argumentsDef);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.definitions.VariableDefinition

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.