Package org.apache.flex.compiler.definitions

Examples of org.apache.flex.compiler.definitions.ITypeDefinition


            for (int i = 0; i < n; i++)
            {
                IReference implementedInterface = implementedInterfaces[i];
               
                ITypeDefinition typeDefinition =
                    resolveType(implementedInterface, project, DependencyType.INHERITANCE);

                if (!(typeDefinition instanceof InterfaceDefinition))
                {
                    IDefinition idef = null;
                    if (typeDefinition == null)
                    {
                        idef = implementedInterface.resolve(project, (ASScope)this.getContainingASScope(), DependencyType.INHERITANCE, true);
                    }
                    if (problems != null)
                    {
                        if (idef instanceof AmbiguousDefinition)
                            problems.add(new AmbiguousReferenceProblem(getNode(), implementedInterface.getDisplayString()));
                        else
                            problems.add(unknownInterfaceProblem(implementedInterface, i));                       
                    }

                    typeDefinition = null;
                }
                else if (seenInterfaces != null)
                {
                    if (seenInterfaces.contains(typeDefinition))
                    {
                        if (problems != null)
                            problems.add(duplicateInterfaceProblem(implementedInterface, i));
                    }
                   
                    seenInterfaces.add((InterfaceDefinition)typeDefinition);
                }
               
                if (problems != null)
                {
                    // Report a problem if the interface is deprecated
                    // and the reference to it is not within a deprecated API.
                    if (typeDefinition != null && typeDefinition.isDeprecated())
                    {
                        IASNode node = getInterfaceNode(i);
                        if (!SemanticUtils.hasDeprecatedAncestor(node))
                        {
                            ICompilerProblem problem = SemanticUtils.createDeprecationProblem(typeDefinition, node);
                            problems.add(problem);
                        }
                    }
                }
                
                result[i] = (InterfaceDefinition)typeDefinition;
            }

            if (includeImplicits)
            {
                if (needsEventDispatcher(project))
                {
                    ITypeDefinition iEventDispatcher = resolveType(IASLanguageConstants.IEventDispatcher, project, null);
                    if (iEventDispatcher instanceof InterfaceDefinition)
                    {
                        InterfaceDefinition[] newResult = new InterfaceDefinition[result.length + 1];
                        System.arraycopy(result, 0, newResult, 0, result.length);
                        newResult[result.length] = (InterfaceDefinition)iEventDispatcher;
View Full Code Here


     */
    public boolean computeNeedsEventDispatcher(ICompilerProject project)
    {
        if (isBindable() || getContainedScope().hasAnyBindableDefinitions())
        {
            ITypeDefinition iEventDispatcher = resolveType(IASLanguageConstants.IEventDispatcher, project, null);
            if (iEventDispatcher != null)
            {

                IClassDefinition baseClass = resolveBaseClass(project);
                if (baseClass != null)
View Full Code Here

    }

    public boolean hasCompatibleSignature(IFunctionDefinition other, ICompilerProject project)
    {
        // Compare return types.
        ITypeDefinition returnType1 = resolveReturnType(project);
        ITypeDefinition returnType2 = other.resolveReturnType(project);
        if (returnType1 != returnType2)
            return false;
           
        // Compare parameters.
        IParameterDefinition[] params1 = getParameters();
        IParameterDefinition[] params2 = other.getParameters();

        // Compare number of parameters.
        int n1 = params1 != null ? params1.length : 0;
        int n2 = params2 != null ? params2.length : 0;
        if (n1 != n2)
            return false;

        for (int i = 0; i < n1; i++)
        {
            IParameterDefinition param1 = params1[i];
            IParameterDefinition param2 = params2[i];

            // Compare ith parameter types.
            // The types must be resolved because one might be
            // "Sprite" and the other "flash.display.Sprite".
            ITypeDefinition type1 = param1.resolveType(project);
            ITypeDefinition type2 = param2.resolveType(project);
            if (type1 != type2)
                return false;

            // Compare ith parameter 'rest' flag.
            boolean rest1 = param1.isRest();
View Full Code Here

        // We'll do a bit better: if b and c have identical type
        // then we'll consider (a ? b : c) to be that type.
        // We should probably determine the common base type of b and c,
        // but if either or both types are interfaces rather than classes,
        // it isn't obvious what this means.
        ITypeDefinition leftType = getLeftOperandNode().resolveType(project);
        ITypeDefinition rightType = getRightOperandNode().resolveType(project);
        if (leftType == rightType)
            return leftType;

        return project.getBuiltinType(BuiltinType.ANY_TYPE);
    }
View Full Code Here

        if (baseClassReference == null)
            return null;

        // Resolve the base class reference within the project,
        // and establish an inheritance dependency.
        ITypeDefinition typeDefinition =
                resolveType(baseClassReference, project, INHERITANCE);

        if (typeDefinition == null)
            return null;
View Full Code Here

            // the skinPart definition needs to be either a variable or getter
            if (!((skinPartDef instanceof IVariableDefinition) || (skinPartDef instanceof IGetterDefinition)))
                skinPartDef = null;

            ITypeDefinition skinPartTypeDef = null;
            if (skinPartDef != null)
                skinPartTypeDef = skinPartDef.resolveType(project);

            if (skinPartTypeDef == null && hostSkinPartDef.isRequiredSkinPart())
            {
                ICompilerProblem problem = new MissingSkinPartProblem(skinPart, hostComponentDef.getBaseName());
                problems.add(problem);
            }
            else if (skinPartTypeDef != null && !skinPartTypeDef.isInstanceOf(hostSkinPartDef.resolveType(project), project))
            {
                ICompilerProblem problem = new WrongSkinPartProblem(skinPart, skinPartTypeDef, hostSkinPartDef.resolveType(project));
                problems.add(problem);

            }
View Full Code Here

    }

    @Override
    public boolean isInstanceOf(String qualifiedName, ICompilerProject project)
    {
        ITypeDefinition t = resolveType(qualifiedName, project, null);
        if (t == null)
            return false;

        return isInstanceOf(t, project);
    }
View Full Code Here

    @Override
    public boolean isDynamicExpression(ICompilerProject project)
    {
        boolean isDynamic = true;

        ITypeDefinition type = resolveType(project);
        if (type != null)
            isDynamic = type.isDynamic();

        return isDynamic;
    }
View Full Code Here

        for (IDefinition def : result.getExternallyVisibleDefinitions())
        {
            if (appAndModuleDefs. isApplicationOrModule(def))
            {
                assert def instanceof ITypeDefinition;
                final ITypeDefinition typeDef = (ITypeDefinition)def;
                // If the mainClass extends this class then don't report a problem
                assert mainApplicationClassDefinition instanceof ITypeDefinition;
                if (!mainApplicationClassDefinition.isInstanceOf(typeDef, flexProject))
                {
                    problems.add(new CompiledAsAComponentProblem(cu.getName(),
View Full Code Here

         */
        boolean isApplicationOrModule(IDefinition def)
        {
            if (!(def instanceof ITypeDefinition))
                return false;
            ITypeDefinition typeDef = (ITypeDefinition)def;
            if (typeDef == sparkApplication ||
                typeDef == iModule ||
                typeDef == haloApplication)
            {
                return false;
            }
               
                return ((sparkApplication != null && typeDef.isInstanceOf(sparkApplication, flexProject)) ||
                        (iModule != null && typeDef.isInstanceOf(iModule, flexProject)) ||
                        (haloApplication != null && typeDef.isInstanceOf(iModule, flexProject)));
        }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.definitions.ITypeDefinition

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.