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

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


    {
        startProfile(Operation.GET_FILESCOPE);
       
        try
        {
            final ASFileScope fileScope = new ASFileScope(getProject().getWorkspace(), null);

            Multiname mname = Multiname.crackDottedQName(getProject(), qname);
            INamespaceDefinition packageNS = Iterables.getOnlyElement(mname.getNamespaceSet());

            final ClassDefinition classDefinition = new ClassDefinition(mname.getBaseName(),
                    (INamespaceReference)packageNS);
            fileScope.addDefinition(classDefinition);

            return new FileScopeRequestResultBase(Collections.<ICompilerProblem> emptySet(),
                    ImmutableSet.<IASScope> of(fileScope));
        }
        finally
View Full Code Here


    }

    @Override
    public IScriptVisitor visitScript()
    {
        final ASFileScope fileScope = this.fileScopeProvider.createFileScope(workspace, path);
        assert fileScope != null : "IFileScopeProvider shouldn't create null objects.";
        scopes.add(fileScope);
        return new ScriptDefinitionBuilder(this, fileScope);
    }
View Full Code Here

            final Collection<ICompilerProblem> problems = new LinkedList<ICompilerProblem>();
           
            PropertiesFileParser parser = new PropertiesFileParser(getProject().getWorkspace());
            final ResourceBundleFileNode fileNode = parser.parse(getFileName(), this.locale, getFileReader(problems), problems);

            ASFileScope fileScope = createFileScope(fileNode);
            addScopeToProjectScope(new ASFileScope[] { fileScope });

            return new SyntaxTreeRequestResult(fileNode, ImmutableSet.<String>of(), getRootFileSpecification().getLastModified(), problems);
        }
        finally
View Full Code Here

     * @return root file scope for this compilation unit
     */
    private ASFileScope createFileScope(final ResourceBundleFileNode fileNode)
    {
        List<IDefinition> definitions = getDefinitionPromises();
        ASFileScope fileScope = new ASFileScope(fileNode);

        String packageName = Multiname.getPackageNameForQName(definitions.get(0).getQualifiedName());
        PackageScope packageScope = new PackageScope(fileScope, packageName);
        packageScope.setContainingScope(fileScope);

        PackageDefinition packageDefinition = new PackageDefinition(packageName);
        packageDefinition.setContainedScope(packageScope);

        fileScope.addDefinition(packageDefinition);
       
        for(IDefinition def : definitions)
        {
            Multiname mname = Multiname.crackDottedQName(getProject(), def.getQualifiedName());
            INamespaceDefinition packageNS = Iterables.getOnlyElement(mname.getNamespaceSet());
View Full Code Here

            }
            else
            {
                Collection<ICompilerProblem> problems = new LinkedList<ICompilerProblem>();
                FileNode fileNode = transcoder.buildAST(problems, getAbsoluteFilename());
                final ASFileScope fileScope = fileNode.getFileScope();
                addScopeToProjectScope(new ASFileScope[] { fileScope });
                markClassAsEmbed(fileScope);

                return new SyntaxTreeRequestResult(fileNode, fileNode.getIncludeHandler().getIncludedFiles(), getRootFileSpecification().getLastModified(), problems);
            }
View Full Code Here

    {
        DefinitionBase definition = (DefinitionBase)getDecoratedDefinition();
        if (definition == null)
            return null;

        final ASFileScope fileScope = definition.getFileScope();
        if (fileScope == null)
            return null;

        return fileScope.getOffsetLookup();
    }
View Full Code Here

        ASScope containingScope = (ASScope)getDecoratedDefinition().getContainingScope();
        if (containingScope == null)
            return null;

        // Get the file scope for that scope.
        ASFileScope fileScope = containingScope.getFileScope();
        if (fileScope == null)
            return null;

        // Get the workspace.
        IWorkspace workspace = fileScope.getWorkspace();
        assert workspace != null;

        // Use the stored NodeReference to get the original node.
        IASNode node = nodeRef.getNode(workspace, containingScope);
        if (!(node instanceof IMetaTagNode))
View Full Code Here

     * Synthesize a file scope with a public definition of module main class.
     */
    @Override
    protected IFileScopeRequestResult handleFileScopeRequest() throws InterruptedException
    {
        final ASFileScope fileScope = new ASFileScope(getProject().getWorkspace(), cssFile.getPath());
        // TODO: Generate class names from CSS file name after the CSS module runtime code is finalized.
        final ClassDefinition classDefinition = new ClassDefinition(
                "CSSModule2Main",
                NamespaceDefinition.createPackagePublicNamespaceDefinition(""));
        fileScope.addDefinition(classDefinition);
        return new FileScopeRequestResultBase(
                Collections.<ICompilerProblem> emptySet(),
                ImmutableSet.<IASScope> of(fileScope));
    }
View Full Code Here

        return fileSpec != null ? fileSpec.getPath() : null;
    }

    private OffsetLookup getOffsetLookup()
    {
        final ASFileScope fileScope = getFileScope();
        if (fileScope == null)
            return null;

        return fileScope.getOffsetLookup();
    }
View Full Code Here

    }

    @Override
    public String getContainingFilePath()
    {
        ASFileScope fileScope = getFileScope();
        if (fileScope == null)
            return null;
        return fileScope.getContainingPath();
    }
View Full Code Here

TOP

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

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.