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

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


                        // TODO Add namespace logic.
                        // Can MXML set protected properties?
                        // Can MXML set mx_internal properties if you've done
                        // 'use namesapce mx_internal' in a <Script>?
                        winner = definition;
                        final INamespaceReference namespaceReference = definition.getNamespaceReference();
                        final INamespaceDefinition thisNamespaceDef = namespaceReference.resolveNamespaceReference(this);
                        final boolean isBindable = ((NamespaceDefinition)thisNamespaceDef).getAETNamespace().getName().equals(
                                BindableHelper.bindableNamespaceDefinition.getAETNamespace().getName());
                        // if we find a setter always take it, otherwise
                        // keep looking for a setter
                        if (winner instanceof ISetterDefinition && !isBindable)
View Full Code Here


            assert reference instanceof UserDefinedNamespaceReference : "Unexpected implementation of INamespaceReference";
            UserDefinedNamespaceReference userDefinedNamespaceReference =
                    ((UserDefinedNamespaceReference)reference);

            final String baseName = userDefinedNamespaceReference.getBaseName();
            final INamespaceReference qualifier = userDefinedNamespaceReference.getQualifierNamespace();
            if (qualifier != null)
            {
                INamespaceDefinition resolvedQualifier = resolveDirectiveReference(qualifier);
                if (resolvedQualifier == null)
                    return null;
View Full Code Here

     */
    private void checkForNamespaceInFunction(BaseDefinitionNode node, LexicalScope scope)
    {
        assert SemanticUtils.isInFunction(node);
        DefinitionBase def = node.getDefinition();
        INamespaceReference nsRef = def.getNamespaceReference();
        if (!(nsRef instanceof NamespaceDefinition.IInternalNamespaceDefinition) &&
                !(nsRef instanceof NamespaceDefinition.IFilePrivateNamespaceDefinition))
        {
            IASNode site = node.getNamespaceNode();
            if (site == null)
View Full Code Here

    /**
     * Check that the namespace of the definition is valid
     */
    public void checkNamespaceOfDefinition(IASNode iNode, IDefinition def, ICompilerProject project)
    {
        INamespaceReference nsRef = def.getNamespaceReference();
       
        // If it's not a language namespace, then it is only valid if the def is declared in a class
        if( !nsRef.isLanguageNamespace() && !(def.getParent() instanceof IClassDefinition) )
        {
            // if in function, we will already generate the error that no overrides at all are allowed
            if (!SemanticUtils.isInFunction(iNode))
                addProblem(new InvalidNamespaceProblem(iNode instanceof BaseDefinitionNode ?
                                                    ((BaseDefinitionNode)iNode).getNamespaceNode() :
                                                    iNode));
        }

        if( nsRef == NamespaceDefinition.getCodeModelImplicitDefinitionNamespace()
                // constructors are left in the CMImplicit namespace so that FB continues to work right
                && !isConstructor(def) )
        {
            // This should only happen if an invalid access namespace was specified
            // e.g. private outside of a class
            BaseDefinitionNode bdn = iNode instanceof BaseDefinitionNode ? (BaseDefinitionNode)iNode : null;
            if( bdn != null )
            {
                INamespaceDecorationNode nsNode = bdn.getNamespaceNode();
                if( nsNode != null )
                {
                    String nsString = nsNode.getName();
                    if( nsString == IASKeywordConstants.PUBLIC )
                    {
                        addProblem(new InvalidPublicNamespaceAttrProblem(nsNode) );
                    }
                    else if( nsString == IASKeywordConstants.PROTECTED )
                    {
                        addProblem(new InvalidProtectedNamespaceAttrProblem(nsNode) );
                    }
                    else if( nsString == IASKeywordConstants.PRIVATE )
                    {
                        addProblem(new InvalidPrivateNamespaceAttrProblem(nsNode));
                    }
                }
            }
        }
       
        IASNode nsNode = iNode instanceof BaseDefinitionNode ?
                ((BaseDefinitionNode)iNode).getNamespaceNode() :
                iNode;

        INamespaceDefinition nsDef = nsRef.resolveNamespaceReference(project);
       
        if (nsRef.resolveNamespaceReference(project) == null)
            addProblem(new UnresolvedNamespaceProblem(nsNode));
       
        checkDeprecated(nsNode, nsDef);
    }
View Full Code Here

        assert !(def.getContainingScope() instanceof FunctionScope);
        assert !(def.getContainingScope() instanceof ScopeView);
        assert !(def.getContainingScope() instanceof TypeScope);
        assert !(def instanceof ParameterDefinition);

        INamespaceReference qualifier = def.getNamespaceReference();
        if (!qualifier.isPublicOrInternalNamespace())
            return def;
        INamespaceDefinition qualifierDef = (INamespaceDefinition)qualifier;
        IResolvedQualifiersReference refToDefinition =
                ReferenceFactory.resolvedQualifierQualifiedReference(project.getWorkspace(), qualifierDef, def.getBaseName());
        return refToDefinition.resolve(project);
View Full Code Here

    public static void checkScopedToDefaultNamespaceProblem(LexicalScope scope, BaseDefinitionNode node, IDefinition definition, String className)
    {
        if (node == null)       // if we don't have a node, it means we didn't come from source code, so there is no point
                                // in doing a semantic check
            return;
        INamespaceReference nsref = definition.getNamespaceReference();
        INamespaceDecorationNode dec = node.getNamespaceNode();
        if ((dec ==null) &&(nsref instanceof INamespaceDefinition.IInternalNamespaceDefinition))
        {
            String type = "declaration";        // should never see this string...
            if (definition instanceof IFunctionDefinition)
View Full Code Here

    {
        // We know that all interface or class definitions are top level
        // definitions so we overload this method to
        // avoid the base class method trying to run up the scope
        // chain to find the toplevel definition.
        INamespaceReference namespaceRef = getNamespaceReference();
        if (namespaceRef instanceof NamespaceDefinition.INamespaceWithPackageName)
            return ((NamespaceDefinition.INamespaceWithPackageName)namespaceRef).getNamespacePackageName();
        return "";
    }
View Full Code Here

                // This needs to generate a QName with a.b.c as the qualifier.
                if (baseIsPackage())
                {
                    String packageName = baseExpr.computeSimpleReference();
                    Workspace workspace = (Workspace)project.getWorkspace();
                    INamespaceReference qualifier = workspace.getPackageNamespaceDefinitionCache().get(packageName, false);

                    return new Name(isAttributeIdentifier() ? CONSTANT_QnameA : CONSTANT_Qname,
                            new Nsset(qualifier.resolveAETNamespace(project)), getName());
                }

                Set<INamespaceDefinition> namespaceSet = null;
                IDefinition baseType = baseExpr.resolveType(project);
View Full Code Here

        // Parser creates IdentifierNodes for "" for some error cases
        // of improperly written code,
        if (name == "")
            return null;
       
        INamespaceReference nsRef = null;
        Workspace w = (Workspace)getWorkspace();

        switch (getRefType())
        {
            case PACKAGE_QUALIFIED:
View Full Code Here

               
            default:
                throw new IllegalStateException("Invalid slot kind: " + kind);
        }
       
        final INamespaceReference namespaceReference = getNamespaceReference(name);
        def.setNamespaceReference(namespaceReference);

        if (isStatic)
            def.setStatic();
View Full Code Here

TOP

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

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.