Package org.apache.flex.compiler.definitions.references

Examples of org.apache.flex.compiler.definitions.references.IReference


    public static ClassDefinition resolveBaseClass(ICommonClassNode classNode,
                                                   ClassDefinition classDefinition,
                                                   ICompilerProject project,
                                                   Collection<ICompilerProblem> problems)
    {
        IReference baseClassReference = classDefinition.getBaseClassReference();
       
        // Object has no base class.
        if (baseClassReference == null)
            return null;
       
        ITypeDefinition superclassDefinition = classDefinition.resolveType(
            baseClassReference, project, DependencyType.INHERITANCE);
       
        if (superclassDefinition == null)
        {
            IASNode problemNode = getBaseClassProblemNode(classNode, classDefinition);
            String baseClassReferenceName = baseClassReference.getName();

            //  The base class reference might be ambiguous.
            IDefinition foundDefinition = baseClassReference.resolve(project, (ASScope)classDefinition.getContainingScope(), DependencyType.INHERITANCE, true);
            if ( AmbiguousDefinition.isAmbiguous(foundDefinition))
                problems.add(new AmbiguousReferenceProblem(problemNode, baseClassReferenceName));
            else
                problems.add(new UnknownSuperclassProblem(problemNode, baseClassReferenceName));
           
View Full Code Here


        // Parser creates IdentifierNodes for "" for some error cases of improperly written code,
        // like class C extends {} - it gets an IDNode of "" for the extends clause
        if (name == "")
            return null;

        IReference typeRef = null;

        IWorkspace w = getWorkspace();

        switch (getRefType())
        {
View Full Code Here

                break;
            }
            case MEMBER:
            {
                ExpressionNodeBase baseExpr = getBaseExpression();
                IReference base = baseExpr.computeTypeReference();
                nsRef = NamespaceDefinition.createNamespaceReference(getASScope(), getName(), null, base);
                break;
            }
            default:
            {
View Full Code Here

        {
            Multiname mname = Multiname.crackDottedQName(getProject(), def.getQualifiedName());
            INamespaceDefinition packageNS = Iterables.getOnlyElement(mname.getNamespaceSet());

            ClassDefinition classDefinition = new ClassDefinition(mname.getBaseName(), (INamespaceReference)packageNS);
            IReference baseClass = ReferenceFactory.packageQualifiedReference(getProject().getWorkspace(), getFlexProject().getResourceBundleClass());
            classDefinition.setBaseClassReference(baseClass);
            classDefinition.setExcludedClass();

            TypeScope classScope = new TypeScope(packageScope, classDefinition);
            classScope.setContainingDefinition(classDefinition);
View Full Code Here

    IReference getReference(Name name)
    {
        if( name == null )
            return null;

        IReference ref = nameMap.get(name);
        if( ref != null )
            return ref;

        switch( name.getKind() )
        {
            case ABCConstants.CONSTANT_Qname:
                INamespaceDefinition ns = getNamespaceReferenceForNamespace(name.getSingleQualifier());
                ref = ReferenceFactory.resolvedQualifierQualifiedReference(workspace, ns, name.getBaseName());
                break;
            case ABCConstants.CONSTANT_Multiname:
                Nsset set = name.getQualifiers();
                if (set.length() != 1)
                {
                    Set<INamespaceDefinition> ns_set = new HashSet<INamespaceDefinition>(set.length());
                    for( Namespace n : set )
                        ns_set.add(getNamespaceReferenceForNamespace(n));
                    ref = ReferenceFactory.multinameReference(workspace, ns_set, name.getBaseName());
                }
                else
                {
                    INamespaceDefinition singleNS = getNamespaceReferenceForNamespace(name.getSingleQualifier());
                    ref = ReferenceFactory.resolvedQualifierQualifiedReference(workspace, singleNS, name.getBaseName());
                }
                break;
            case ABCConstants.CONSTANT_TypeName:
                // If we ever support more than Vector, we'll need to harden this code against loops
                // in the type name's.
                assert name.getTypeNameBase().getBaseName().equals("Vector") : "Vector is currently the only supported parameterized type!";
                IReference parameterizedTypeReference = getReference(name.getTypeNameBase());
                IReference parameterTypeReference = getReference(name.getTypeNameParameter());
                ref = ReferenceFactory.parameterizedReference(workspace, parameterizedTypeReference, parameterTypeReference);
                break;
            default:
                assert false : "Unsupported multiname type: " + name.getKind();
        }
View Full Code Here

                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);
View Full Code Here

    public void setRest()
    {
        flags |= FLAG_REST;
       
        // The type of a '...' parameter is always Array.
        IReference arrayTypeReference = ReferenceFactory.builtinReference(BuiltinType.ARRAY);
        setTypeReference(arrayTypeReference);
    }
View Full Code Here

                seenInterfaces = new HashSet<InterfaceDefinition>();
            }

            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;
View Full Code Here

        Multiname mname = Multiname.crackDottedQName(getProject(), qname);
        INamespaceDefinition packageNS = Iterables.getOnlyElement(mname.getNamespaceSet());

        ClassDefinition classDefinition = new ClassDefinition(mname.getBaseName(), (INamespaceReference)packageNS);
        IReference baseClass = ReferenceFactory.packageQualifiedReference(getProject().getWorkspace(), fxgBaseClassName);
        classDefinition.setBaseClassReference(baseClass);

        TypeScope classScope = new TypeScope(packageScope, classDefinition);
        classScope.setContainingDefinition(classDefinition);
        classDefinition.setContainedScope(classScope);
View Full Code Here

        return fileScope;
    }

    private void processRootTag(IMXMLTagData rootTag)
    {
        IReference baseClass = fileScope.resolveTagToReference(rootTag);

        String implementsAttrValue = rootTag.getRawAttributeValue("implements");
        IReference[] implementedInterfaces = null;
        if (implementsAttrValue != null) //TODO this should use a parser method that collects qnames or identifiers
        {
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.definitions.references.IReference

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.