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

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


        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

                scope.addDefinition(definition);    // This sets the containing scope of the def

            ScopedBlockNode contents = contentsPart.getContents();
            if (contents != null)
            {
                ASScope localScope = new FunctionScope(scope, contents);
                definition.setContainedScope(localScope);
                scope = localScope;
            }
        }
View Full Code Here

                {
                    newDef = new FunctionDefinition(name);
                    newDef.setReturnTypeReference(defaultFunc.getReturnTypeReference());
                }

                ASScope newScope = new FunctionScope(scope);
                newDef.setContainedScope(newScope);

                newDef.setNamespaceReference(defaultDef.getNamespaceReference());

                if (info != null)
                {
                    if (info.returnIsTypeOfCollection())
                        newDef.setReturnTypeReference(ReferenceFactory.resolvedReference(elementType));
                    else if (info.returnIsVector())
                        newDef.setReturnTypeReference(ReferenceFactory.resolvedReference(this));
                }
                ParameterDefinition[] params = defaultFunc.getParameters();

                if (params != null)
                {
                    VectorInformation.ArgumentInfo[] args = info != null ? info.getArgumentInfo() : null;
                    ParameterDefinition[] newParams = new ParameterDefinition[params.length];
                    for (int i = 0, l = params.length; i < l; ++i)
                    {
                        if (args != null && i < args.length)
                        {
                            newParams[i] = copyParameter(project, params[i], args[i]);
                            if (args[i].returnIsVector())
                                newParams[i].setTypeReference(ReferenceFactory.resolvedReference(this));
                            else if (args[i].returnIsTypeOfCollection())
                                newParams[i].setTypeReference(ReferenceFactory.resolvedReference(elementType));
                        }
                        else
                        {
                            newParams[i] = copyParameter(project, params[i], null);
                        }
                        newScope.addDefinition(newParams[i]);

                    }
                    newDef.setParameters(newParams);
                }
                scope.addDefinition(newDef);
View Full Code Here

        // Set up the params for the setter
        ParameterDefinition param = new ParameterDefinition("");
        param.setTypeReference(typeRef);
        setter.setParameters(new ParameterDefinition[] {param});
        setter.setTypeReference(typeRef);
        ASScope setterContainedScope = new FunctionScope(containingScope);
        setter.setContainedScope(setterContainedScope);
        setterContainedScope.addDefinition(param);
        setter.setReturnTypeReference(ReferenceFactory.builtinReference(IASLanguageConstants.BuiltinType.VOID));

        return setter;
    }
View Full Code Here

TOP

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

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.