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

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


        int paramTypesSize = method.getParamTypes().size();
        final ParameterDefinition params[] = new ParameterDefinition[paramTypesSize + (method.needsRest() ? 1 : 0)];
        if (params.length > 0)
        {
            ASScope methodScope = new FunctionScope(scope);
            methodScope.setContainingDefinition(methodDef);
            methodDef.setContainedScope(methodScope);
            Vector<PooledValue> defaultValues = method.getDefaultValues();
            int firstOptionalParam = paramTypesSize - defaultValues.size();
            for (int i = 0; i < paramTypesSize; i++)
            {
                final Name paramType = method.getParamTypes().get(i);
                final String paramName = i < method.getParamNames().size() ? method.getParamNames().get(i) : MethodInfo.UNKNOWN_PARAM_NAME;
                params[i] = new ParameterDefinition(paramName);
                params[i].setTypeReference(paramType == null ? TYPE_ANY : scopeBuilder.getReference(paramType));
                if (i >= firstOptionalParam)
                {
                    Object defaultValue = defaultValues.get(i - firstOptionalParam).getValue();
                    params[i].setDefaultValue(defaultValue);
                }
                methodScope.addDefinition(params[i]);
            }
            if( method.needsRest() )
            {
                ParameterDefinition rest = new ParameterDefinition(MethodInfo.UNKNOWN_PARAM_NAME);
                rest.setRest();
View Full Code Here


            classDef.getContainedScope().addDefinition(ctor);

            IParameterDefinition[] params = ctor.getParameters();
            if (params.length > 0)
            {
                ASScope ctorScope = new FunctionScope(scope);
                ctorScope.setContainingDefinition(ctor);
                ctor.setContainedScope(ctorScope);

                for (IParameterDefinition param : params)
                {
                    ctorScope.addDefinition(param);
                }
            }
        }

        return new CollectMetadataTraitVisitor(classDef);
View Full Code Here

        // Make sure they have the same name, and namespace, otherwise they can't possible be a re-decl
        if (!namesAndContainingScopeMatch(project, f1, f2))
            return null;

        ASScope containingScope = (ASScope)f1.getContainingScope();
        if ((containingScope instanceof ASFileScope) || (containingScope.getContainingDefinition() instanceof FunctionDefinition))
        {
            // All function declarations match, because functions
            // declared outside of a package are really variables of
            // type * that are initialized to function closures.

View Full Code Here

    {
        if (isBuiltinNamespaceIdentifier())
        {
            // Resolve public, private, internal, or protected special-like
            // this is so exprs like public::x work correctly.
            ASScope scope = getASScope();
            INamespaceReference nsRef = NamespaceDefinition.createNamespaceReference(scope, this);
            return nsRef != null ? nsRef.resolveNamespaceReference(project) : null;
        }

        IDefinition d = super.resolve(project);
View Full Code Here

    public IQualifiers resolveQualifier(ICompilerProject project )
    {
        IQualifiers result = null;
        if( isBuiltinNamespaceIdentifier() )
        {
            ASScope scope = getASScope();
            // Only do the multi namespace processing if there is a decent chance
            // we will end up with many namespaces
            if( NamespaceDefinition.qualifierCouldBeManyNamespaces(scope, this) )
            {
                // Get all the namespace refs
View Full Code Here

            if (wasOverride)
                funcDef.setOverride();
            if (funcDef instanceof GetterDefinition)
            {
                DefinitionBase bindableGetter = func.buildBindableGetter(funcName.getBaseName());
                ASScope funcScope = (ASScope)funcDef.getContainingScope();
                bindableGetter.setContainingScope(funcScope);
                LexicalScope ls = funcDef.isStatic()? classStaticScope: classScope;
                ls.generateBindableGetter(bindableGetter, funcName, bindableName,
                                        funcDef.resolveType(project).getMName(project), getAllMetaTags(funcDef));
            }
            else
            {
                TypeDefinitionBase typeDef = funcDef.resolveType(project);
                ASScope funcScope = (ASScope)funcDef.getContainingScope();
                DefinitionBase bindableSetter = func.buildBindableSetter(funcName.getBaseName(),
                        funcScope,
                        funcDef.getTypeReference());
                bindableSetter.setContainingScope(funcScope);
                LexicalScope ls = funcDef.isStatic()? classStaticScope: classScope;
View Full Code Here

        // by looking at its containing scope.
        //
        // Local variables don't always have a containing
        // function definition ( MXML event specifiers is one
        // example ).
        ASScope containingScope = getContainingASScope();
        if (containingScope instanceof FunctionScope)
            return VariableClassification.LOCAL;
        if (containingScope instanceof CatchScope)
            return VariableClassification.LOCAL;
View Full Code Here

        }
        else if (parent == null)
        {
            // if the parent definition is null, we must be at file scope, so must search the scope
            // directly
            ASScope scope = this.getContainingASScope();
            return findCorrespondingAccessor(scope, project);
        }
        else
            assert false; // we should have code for all cases...
View Full Code Here

     * @return an accessor definition that matches, or null if none found
     */

    private AccessorDefinition findCorrespondingAccessor(IScopedDefinition type, ICompilerProject project)
    {
        final ASScope scope = (ASScope)type.getContainedScope();
        return findCorrespondingAccessor(scope, project);
    }
View Full Code Here

        // If this definition didn't come from source, return null.
        if (nodeRef == NodeReference.noReference)
            return null;

        // Get the scope for the definition this metadata is attached to.
        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();
View Full Code Here

TOP

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

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.