Package org.apache.flex.compiler.internal.scopes

Examples of org.apache.flex.compiler.internal.scopes.ASProjectScope


    public void addDependency(String qname, DependencyType type)
    {
        if (qname == null)
            return;

        ASProjectScope projectScope = getProjectScope();
        IDefinition definition = projectScope.findDefinitionByName(qname);

        if (definition == null)
            return;

        ICompilationUnit thisCU = getCompilationUnit();
        ICompilationUnit otherCU = projectScope.getCompilationUnitForDefinition(definition);

        // otherCU will be null if qname is "*" because the "*" type does not come from any compilation unit
        if (otherCU != null)
        {
            FlexProject project = getProject();
View Full Code Here


        // The classReference set onto AppliedVectorDefinition
        // is to the bare  __AS3__.vec.Vector class,
        // which is what the <Vector> tag maps to.
        // But we really want it to be the Vector.<T> class
        // specified by the type="T" attribute.
        ASProjectScope projectScope = (ASProjectScope)project.getScope();
        return projectScope.newVectorClass(type);
    }
View Full Code Here

    {
        String importName = importNode.getImportName();

        // First check whether the import name matches
        // a definition in the project scope.
        ASProjectScope projectScope = (ASProjectScope)project.getScope();
        if (projectScope.isValidImport(importName))
            return true;
       
        // For an invisible compilation unit, which doesn't contribute
        // definitions to the project scope, we must also check
        // whether it matches an externally visible definition
View Full Code Here

    {
        List<IDefinition> definitionPromises = unit.getDefinitionPromises();
        if (definitionPromises == null || definitionPromises.size() == 0)
            return false;

        ASProjectScope scope = getScope();
        Set<IDefinition> toDefs = scope.getShadowedDefinitions(definitionPromises.get(0));
        if (toDefs != null)
        {
            for (IDefinition def : toDefs)
            {
                ICompilationUnit shadowedUnit = scope.getCompilationUnitForDefinition(def);
               
                // Test if a shadowed unit is in the same swc.
                if (swcPath.equals(shadowedUnit.getAbsoluteFilename()))
                {
                    return true;
View Full Code Here

        protected IASNode getRootNode() throws InterruptedException
        {
            if (rootNode != null)
                return rootNode;

            ASProjectScope projectScope = flexProject.getScope();
           
            ClassDefinition mainClassDef = (ClassDefinition) mainApplicationClassDefinition;
            if (mainClassDef.hasOwnFactoryClass(flexProject.getWorkspace()))
                return null;

            ICompilationUnit mainUnit = projectScope.getCompilationUnitForDefinition(mainClassDef);
            IRequest<ISyntaxTreeRequestResult, ICompilationUnit> request = mainUnit.getSyntaxTreeRequest();
            ISyntaxTreeRequestResult result = request.get();

            rootNode = result.getAST();
            return rootNode;
View Full Code Here

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

        ITypeDefinition type = vectorNode.getType();
        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

        try
        {
            final FlexProject flexProject = (FlexProject)getProject();
           
            //flex.compiler.support.ResourceModuleBase
            ASProjectScope scope = flexProject.getScope();
            IDefinition def = scope.findDefinitionByName(flexProject.getResourceModuleBaseClass());
            ICompilationUnit resourceModuleBaseCompUnit = scope.getCompilationUnitForDefinition(def);
            flexProject.addDependency(this, resourceModuleBaseCompUnit, DependencyType.INHERITANCE,
                    def.getQualifiedName());
           
            //Add dependency to all the resource bundle compilation units we want to
            //include in the resource module SWF
View Full Code Here

            final Collection<ICompilerProblem> problems)
    {
        final ImmutableSet.Builder<ICompilationUnit> builder = new ImmutableSet.Builder<ICompilationUnit>();
        for (final IClassDefinition classDefinition : classDefinitions)
        {
            final ASProjectScope scope = flexProject.getScope();
            final ICompilationUnit compilationUnit = scope.getCompilationUnitForDefinition(classDefinition);
            if (compilationUnit != null)
                builder.add(compilationUnit);
            else
                assert problemCreatedForUnresolvedClassReference(problems, classDefinition) : "Can't find compilation unit for class '" + classDefinition.getQualifiedName() + "'. Expected a 'CSSUnresolvedClassReference'.";
        }
View Full Code Here

    private void analyze(Collection<ICompilerProblem> problems)
    {
        // if this class extends another, add a dependency on this compilation unit to the class that it extends
        if (embedData.generatedClassExtendsAnother())
        {
            ASProjectScope projectScope = getProject().getScope();
            IDefinition[] defs = projectScope.findAllDefinitionsByName(Multiname.crackDottedQName(getProject(), embedData.getTranscoder().getBaseClassQName()));
            ICompilationUnit referencedCU = projectScope.getCompilationUnitForScope(defs[0].getContainingScope());
            getProject().addDependency(this, referencedCU, DependencyType.INHERITANCE, defs[0].getQualifiedName());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.scopes.ASProjectScope

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.