Package org.apache.flex.compiler.internal.definitions

Examples of org.apache.flex.compiler.internal.definitions.TypeDefinitionBase$StaticTypeIterator


                // test for a fallthrough when the return type is non-void, as we
                // need coerce undefined to the return type to mimic returnvoid behavior
                if (!(functionDef instanceof SetterDefinition) && result.canFallThrough() || result.hasPendingLabels())
                {
                    TypeDefinitionBase returnType = (TypeDefinitionBase)functionDef.resolveReturnType(project);
                    if (returnType != currentScope.getProject().getBuiltinType(BuiltinType.VOID) &&
                        returnType != currentScope.getProject().getBuiltinType(BuiltinType.ANY_TYPE))
                    {
                        result.addInstruction(OP_pushundefined);
                        result.addInstruction(OP_coerce, returnType.getMName(project));
                    }
                }

                result.labelNext(inlineFunctionScope.getInlinedFunctionCallSiteLabel());
                inlineFunctionScope.mergeIntoContainingScope(result);
View Full Code Here


                    result.addInstruction(OP_pushundefined);

                    // if the function returns a type, undefined is coerced to that type
                    if (functionDef != null)
                    {
                        TypeDefinitionBase returnType = (TypeDefinitionBase)functionDef.resolveReturnType(currentScope.getProject());
                        if (returnType != null &&
                            !returnType.equals(ClassDefinition.getVoidClassDefinition()) &&
                            !returnType.equals(ClassDefinition.getAnyTypeClassDefinition()))
                        {
                            result.addInstruction(OP_coerce, returnType.getMName(currentScope.getProject()));
                        }
                    }

                    result.addInstruction(OP_jump, inlinedFunctionCallSiteLabel);
                    break;
View Full Code Here

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

        if ( iNode instanceof MemberAccessExpressionNode )
        {
            TypeDefinitionBase type = (TypeDefinitionBase)((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolveType(project);

            if ( type != null )
            {
                starting_scope = ((TypeDefinitionBase)((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolveType(project)).getContainedScope();
                is_static_reference = ((MemberAccessExpressionNode)iNode).getLeftOperandNode().resolve(project) instanceof ClassDefinition;
            }
        }
        else if ( iNode instanceof FunctionCallNode && ((FunctionCallNode)iNode).getNameNode() instanceof MemberAccessExpressionNode )
        {
            MemberAccessExpressionNode member_node = (MemberAccessExpressionNode) ((FunctionCallNode)iNode).getNameNode();
           
            TypeDefinitionBase type = (TypeDefinitionBase)member_node.getLeftOperandNode().resolveType(project);
            if ( type != null )
            {
                starting_scope = type.getContainedScope();
                is_static_reference = member_node.getLeftOperandNode().resolve(project) instanceof ClassDefinition;
            }
        }
        else if ( isInInstanceFunction(iNode, project) )
        {
View Full Code Here

        if ( args.length > 0 )
        {
          Vector<Name> method_args = new Vector<Name>();
          for ( ParameterDefinition arg: args)
          {
                TypeDefinitionBase arg_type = (TypeDefinitionBase)arg.resolveType(project);
                Name type_name = arg_type != null ? arg_type.getMName(project) : null;

            if ( arg.isRest() )
                {
                mi.setFlags( (byte)(mi.getFlags() | ABCConstants.NEED_REST) );
                }
View Full Code Here

           
            ICompilerProject project = this.currentScope.getProject();

            Name var_name = varDef.getMName(project);

            TypeDefinitionBase typeDef = (TypeDefinitionBase)varDef.resolveType(project);
            Name var_type = typeDef != null ? typeDef.getMName(project) : null;
           
            //  It's not necessary to check for duplicates
            //  in the traits because that is a semantic error
            //  in this context.
            ITraitVisitor tv = this.currentScope.traitsVisitor.visitSlotTrait(ABCConstants.TRAIT_Const, var_name, ITraitsVisitor.RUNTIME_SLOT, var_type, LexicalScope.noInitializer);
View Full Code Here

   

    @Override
    public ITraitVisitor visitClassTrait(int kind, Name name, int slot_id, ClassInfo clazz)
    {
        final TypeDefinitionBase classDef = scopeBuilder.classDefinitions.get(clazz);
        assert classDef != null : "Null class def at #" + slot_id;
        scope.addDefinition(classDef);
        classDef.getContainedScope().setContainingScope(scope);

        // Need to setup the scopes for the constructor and any params
        // here instead of ABCScopeBuilder, as we need to have a handle to the
        // class scope which isn't set until here.
        if (classDef instanceof ClassDefinition)
        {
            FunctionDefinition ctor = (FunctionDefinition)((ClassDefinition)classDef).getConstructor();
            classDef.getContainedScope().addDefinition(ctor);

            IParameterDefinition[] params = ctor.getParameters();
            if (params.length > 0)
            {
                ASScope ctorScope = new FunctionScope(scope);
View Full Code Here

        else
        {
            namespaceRef = NamespaceDefinition.createNamespaceDefinition(namespace);
        }

        final TypeDefinitionBase typeDefinition;
        if (isInterface)
        {
            final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(typeName);

            final IReference[] extendedInterfaces = getReferences(iinfo.interfaceNames);
            interfaceDefinition.setExtendedInterfaceReferences(extendedInterfaces);

            setupCastFunction(iinfo, interfaceDefinition);

            typeDefinition = interfaceDefinition;
        }
        else
        {
            String protectedNSURI;
            if (iinfo.hasProtectedNs())
                protectedNSURI = iinfo.protectedNs.getName();
            else
            {
                String classNSURI = namespace.getName();
                protectedNSURI = (classNSURI.isEmpty() ? "" : classNSURI + ":") + typeName;
            }
            NamespaceDefinition.IProtectedNamespaceDefinition protectedNSDefinition = NamespaceDefinition.createProtectedNamespaceDefinition(protectedNSURI);
           
            final ClassDefinition classDefinition = new ClassDefinition(typeName, namespaceRef, protectedNSDefinition);
            final IReference baseClass = getReference(iinfo.superName);
            classDefinition.setBaseClassReference(baseClass);

            final IReference[] implementedInterfaces = getReferences(iinfo.interfaceNames);
            classDefinition.setImplementedInterfaceReferences(implementedInterfaces);

            setupConstructor(iinfo, classDefinition);

            typeDefinition = classDefinition;
        }

       
        final INamespaceDefinition namespaceReference = getNamespaceReferenceForNamespace(namespace);
       
        typeDefinition.setNamespaceReference((INamespaceReference)namespaceReference);

        if (!isSealed)
            typeDefinition.setDynamic();
        if (isFinal)
            typeDefinition.setFinal();

        final TypeDefinitionBuilder visitor = new TypeDefinitionBuilder(this, typeDefinition);

        classDefinitions.put(cinfo, typeDefinition);
View Full Code Here

                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;
                ls.generateBindableSetter(bindableSetter, funcName, bindableName,
                        typeDef.getMName(project), getAllMetaTags(funcDef))
            }
        }
    }
View Full Code Here

    ITraitVisitor declareVariable(VariableNode varNode, DefinitionBase varDef, boolean is_static, boolean is_const, Object initializer)
    {
        final ICompilerProject project = this.classScope.getProject();
        Name var_name = varDef.getMName(project);

        TypeDefinitionBase typeDef = varDef.resolveType(project);
        Name var_type = typeDef != null ? typeDef.getMName(project) : null;

        int trait_kind = is_const? TRAIT_Const: TRAIT_Var;

        LexicalScope ls = is_static? this.classStaticScope: this.classScope;
View Full Code Here

            }

        }

        //  Check the return type.
        TypeDefinitionBase return_type = (TypeDefinitionBase)def.resolveReturnType(project);
        if ( return_type == null )
        {
            //  Error already emitted.
        }
        // Setter return type can only be 'void' or '*'
 
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.definitions.TypeDefinitionBase$StaticTypeIterator

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.