Package org.apache.flex.compiler.scopes

Examples of org.apache.flex.compiler.scopes.IASScope


     * @return              The scope of the base class of the class the member_def is declared in.
     *                      This will return null if the member_def was not declared in a class.
     */
    public static ASScope getSuperClassScope(ICompilerProject project, IDefinition member_def)
    {
        IASScope containingScope = member_def.getContainingScope();
        if( containingScope instanceof ScopeView )
        {
            return ((ScopeView) containingScope).resolveSuperScope(project);
        }
        return null;
View Full Code Here


     @param match_static_to_static - when true, only accept definitions
     */
    public static IDefinition findMemberByName(IASNode iNode, String member_name,  boolean match_static_to_static, ICompilerProject project)
    {
        //  Find a scope to work with.
        IASScope starting_scope = null;

        //  Is this a static reference, e.g., ClassName.staticField?
        boolean is_static_reference = false;

        if ( iNode instanceof MemberAccessExpressionNode )
View Full Code Here

            {
                // occurred earlier in the file so its not a forward ref
                if( to.getAbsoluteStart() < from.getAbsoluteStart() )
                    return false;

                IASScope fromScope = from.getContainingScope();
                IASScope toScope = to.getContainingScope();

                // forward ref within the same scope
                // so it is a forward ref
                if( fromScope == toScope )
                    return true;

                IASScope current = fromScope;
                while( current != null )
                {
                    // Forward ref, but the to scope is contained by the from
                    // scope so it's ok
                    if( current == toScope )
                        return false;
                    current = current.getContainingScope();
                }

                // package scopes should count as global scope
                if( toScope instanceof PackageScope )
                    return false;
View Full Code Here

        // make a dependency on the sdk class DeferredInstanceFromFunction
        IWorkspace workspace = project.getWorkspace();
        IResolvedQualifiersReference ref = ReferenceFactory.packageQualifiedReference(workspace, deferredInstanceFromFunctionClass);
      
        IScopedNode scopedNode = anInstanceNode.getContainingScope();
        IASScope iscope = scopedNode.getScope();
        ASScope scope = (ASScope)iscope;
       
        if (ref == null)
            assert false;
        IDefinition def = ref.resolve(project, scope, DependencyType.EXPRESSION, false);
View Full Code Here

        //  const definitions always conflict.
        if (v1 instanceof ConstantDefinition || v2 instanceof ConstantDefinition)
            return null;

        IASScope containingScope = v1.getContainingScope();
        IScopedDefinition containingDef = v1.getContainingScope().getDefinition();
        if (containingDef instanceof FunctionDefinition || containingScope instanceof ASFileScope)
        {
            // Only global (outside a package) or function locals can be redeclared.
View Full Code Here

        //  const definitions always conflict.
        //  getters/setters always conlflict with vars
        if (varDef instanceof ConstantDefinition || funcDef instanceof AccessorDefinition)
            return null;

        IASScope containingScope = varDef.getContainingScope();
        IScopedDefinition containingDef = varDef.getContainingScope().getDefinition();
        if (containingDef instanceof FunctionDefinition || containingScope instanceof ASFileScope)
        {
            // Only global (outside a package) or function locals can be redeclared.
View Full Code Here

        try
        {
            ISyntaxTreeRequestResult syntaxTreeResult = getSyntaxTreeRequest().get();
            final ResourceBundleFileNode rootNode = (ResourceBundleFileNode)syntaxTreeResult.getAST();

            IASScope fileScope = rootNode.getScope();
            assert fileScope instanceof ASFileScope : "Expect ASFileScope as the top-level scope, but found " + fileScope.getClass();

            return new FileScopeRequestResultBase(Collections.<ICompilerProblem> emptyList(), Collections.singleton(fileScope)) {
               
                @Override
                public IDefinition getMainDefinition(String qname)
View Full Code Here

    }

    @Override
    public final VariableClassification getVariableClassification()
    {
        IASScope containingScope = getContainingScope();
        if (containingScope instanceof CatchScope)
            return VariableClassification.LOCAL;
        return VariableClassification.PARAMETER;
    }
View Full Code Here

            }

            startProfile(Operation.GET_FILESCOPE);
            try
            {
                final IASScope fileScope = rootNode.getScope();
                assert fileScope instanceof ASFileScope : "Expect ASFileScope as the top-level scope, but found " + fileScope.getClass();
                return new EmbedFileScopeRequestResult((ASFileScope)fileScope);
            }
            finally
            {
                stopProfile(Operation.GET_FILESCOPE);
View Full Code Here

            {
                // For a static scope, the base scope will be the instance scope of 'Class'
                ITypeDefinition typeDef = project.getBuiltinType(IASLanguageConstants.BuiltinType.CLASS);
                if( typeDef != null )
                {
                    IASScope s = typeDef.getContainedScope();
                    if( s instanceof TypeScope )
                        result = ((TypeScope) s).getInstanceScope();
                }
            }
            else
            {
                // Not static, so resolve the super class and get it's scope
                IClassDefinition superClass = ((IClassDefinition) owningType).resolveBaseClass(project);
                if( superClass instanceof TypeDefinitionBase)
                {
                    IASScope superScope = superClass.getContainedScope();
                    if( superScope instanceof TypeScope )
                    {
                        switch (kind)
                        {
                            case INSTANCE_AND_STATIC:
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.scopes.IASScope

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.