Package flex2.compiler.util

Examples of flex2.compiler.util.QName


  private void checkForExtraAttributes(Set<QName> validAttributes, Node node)
  {
    for (Iterator<QName> attributes = node.getAttributeNames(); attributes != null && attributes.hasNext();)
    {
      QName qname = attributes.next();
      String namespace = qname.getNamespace();
      String localPart = qname.getLocalPart();
     
      // If this attribute is state-specific we want to only validate against
      // the unqualified attribute identifier.
      Boolean isScoped = TextParser.isScopedName(localPart);
      if (isScoped)
      {
        String[] statefulName = TextParser.analyzeScopedName(localPart);
        qname = (statefulName != null) ? new QName(namespace, statefulName[0]) : qname;
      }

      if (!validAttributes.contains(qname))
      {
        if (localPart.equals(StandardDefs.PROP_INCLUDE_STATES) || localPart.equals(StandardDefs.PROP_EXCLUDE_STATES))
        {
          log(node, node.getLineNumber(qname), new InvalidStateAttributeUsage(node.getLocalPart()));
        }
                else
                {
                    // Prior to Flex 4, qualified attributes were never allowed
                    // so report anything as an unknown attribute.
                    if (getDocumentVersion() < 4)
                    {
                        log(node, node.getLineNumber(qname), new UnknownAttribute(qname, node.image));
                    }
                    else
                    {
                        // In Flex 4 (and later), qualified attributes are
                        // allowed. If they are in the language namespace or
                        // the component node's namespace they must be
                        // understood. Any other namespace is simply ignored
                        // as the attributes may serve as design time metadata
                        // for tools. However, note that unqualified attributes
                        // must be understood by the compiler.
                        if (namespace == null || namespace.length() == 0
                            || namespace.equals(node.getNamespace())
                            || namespace.equals(documentNode.getLanguageNamespace()))
                        {
                            log(node, node.getLineNumber(qname), new UnknownAttribute(qname, node.image));
                        }
                    }
        }
      }
      else if (isScoped  && !(node instanceof DesignLayerNode) )
      {
        // Language attributes may not be state-specific.
        log(node.getLineNumber(qname), new InvalidStateSpecificValue(qname.getLocalPart()));
      }
    }
  }
View Full Code Here


      for (Name name : u.inheritance)
      {
        if (name instanceof QName)
        {
          QName qname = (QName) name;
          String tail = qnames.get(qname);

          if (tail != null && !head.equals(tail) && !dependencies.dependencyExists(head, tail))
          {
            dependencies.addDependency(head, tail);
View Full Code Here

      CompilationUnit u = s.getCompilationUnit();
      if (u != null)
      {
        for (int j = 0, size = u.topLevelDefinitions.size(); j < size; j++)
        {
          QName qName = u.topLevelDefinitions.get(j);
          qname2source.put(qName, s);
        }
      }
    }
  }
View Full Code Here

        else
        {
            for (Map.Entry<QName, Long> entry : signatureChecksums.entrySet())
            {               
                // lookup definition in swc context
                QName qName = (QName) entry.getKey();
                Long dataSignatureChecksum = (Long)entry.getValue();
                Long swcSignatureChecksum = swcContext.getChecksum(qName);
                if (swcSignatureChecksum == null && qName != null)
                {
                    Source source = swcContext.getSource(qName.getNamespace(), qName.getLocalPart());
                    if (source != null)
                    {
                        swcSignatureChecksum = new Long(source.getLastModified());
                    }
                }
View Full Code Here

        if (swcDefSignatureChecksums != null)
        {
            for (Iterator<QName> iter = unit.topLevelDefinitions.iterator(); iter.hasNext();)
            {
                QName qname = iter.next();
                swcDefSignatureChecksums.put(qname, signatureChecksum);
            }
        }
    }
View Full Code Here

  {
    String defName = null, pathName = null;

    if (s.getOwner() == this)
    {
      QName def = s.getCompilationUnit().topLevelDefinitions.last();

      defName = def.getLocalPart();
      pathName = s.getShortName();

      if (defName.equals(pathName))
      {
        return null;
View Full Code Here

  {
    String defPackage = null, pathPackage = null;

    if (s.getOwner() == this)
    {
      QName def = s.getCompilationUnit().topLevelDefinitions.last();

      defPackage = NameFormatter.normalizePackageName(def.getNamespace());
      pathPackage = NameFormatter.toDot(s.getRelativePath(), '/');

      if (defPackage.equals(pathPackage))
      {
        return null;
View Full Code Here

      {
        for (Map.Entry<String, SwcScript> entry : staging.entrySet())
        {
          String def = entry.getKey();

          qnames.add(new QName(def));
          def2script.put(def, entry.getValue());

          if (Trace.swc)
          {
            Trace.trace("Using " + def + " from " + s);
View Full Code Here

                    {
                        String s = inherited.get(j).toString().intern();
                        //Make sure that the inheritance list doesn't contain itself or a package.
                        if (!s.equals(debug) && !s.equals(otherPackage))
                        {
                            QName q = new QName(s);
                            if (!q.getLocalPart().equals(""))
                            {
                                assert !((q.getLocalPart().equals(cls)) && (q.getNamespace().equals(pkg))) : "same class";
                                inherit.add(q);
                            }
                        }
                    }
                }
            }
            else if (current.def instanceof FunctionDefinitionNode)
            {
                FunctionDefinitionNode fd = (FunctionDefinitionNode)current.def;
                debug = fd.fexpr.debug_name;
                int colon = debug.indexOf(':');
                int slash = debug.indexOf('/');
                if (colon < 0)
                {
                    pkg = "";
                    if (slash < 0) //when there's only a name (Ex. debug == Foobar)
                        cls = "";
                    else  //when there happens to be a slash (Ex. debug == Class/Function)
                        cls = debug.substring(0, slash).intern();
                }
                else
                {
                    pkg = debug.substring(0, colon).intern();
                    if (slash < 0)   //when you have debug == packageName:Function
                        cls = "";
                    else if (slash < colon//when debug == className/private:something (mxml case)
                    {
                        pkg = "";
                        cls = debug.substring(0, slash).intern();
                    }
                    else  //when debug == packageName:className/Function
                        cls = debug.substring(colon + 1, slash).intern();
                }
            }
            else if (current.def instanceof VariableDefinitionNode)
            {
                VariableBindingNode vb = (VariableBindingNode)(((VariableDefinitionNode)current.def).list.items.get(0));
                debug = vb.debug_name;
                int colon = debug.indexOf(':');
                int slash = debug.indexOf('/');
                if (colon < 0)
                {
                    pkg = "";
                    if (slash < 0)
                        cls = "";
                    else
                        cls = debug.substring(0, slash).intern();
                }
                else
                {
                    pkg = debug.substring(0, colon).intern();
                    if (slash < 0)
                        cls = "";
                    else if (slash < colon)
                    {
                        pkg = "";
                        cls = debug.substring(0, slash).intern();
                    }
                    else
                        cls = debug.substring(colon + 1, slash).intern();
                }
            }
            //Add to list for other classes (they will be in a separate package)
            if (!pkg.equals(packageName))
            {
                if (cls.equals(""))
                    cls = "null";
                List<DocCommentNode> l = otherClasses.get(cls);
                if (l == null)
                    l = new ArrayList<DocCommentNode>();
                l.add(current);
                otherClasses.put(cls, l);
            }
            else  //Add to list for public class
                mainClass.add(current);
        }
       
        if (mainDef//there exists a public class definition
            this.put(name, mainClass, inheritance, exclude, cx, abcClass);
        else    //null classname for package level functions
            this.put(new QName(packageName, "null"), mainClass, inheritance, exclude, cx, abcClass);
       
        //for classes outside the package but in the same sourcefile (should be private, but we exclude anyway)
        if (otherPackage != null)
        {
            Iterator<String> iter = otherClasses.keySet().iterator();
            while (iter.hasNext())
            {
                //Add other classes under asc generated package name
                String cls = iter.next().intern();
                this.put(new QName(otherPackage, cls), otherClasses.get(cls), otherInheritance.get(cls), true, cx, abcClass);
            }
        }
       
        //This is to ensure that the packageTable contains all the package names (as keys).
        if (!packageTable.containsKey(packageName))
View Full Code Here

        {
            if (packageName == null)
                packageName = "";
            if (className == null || className.equals(""))
                className = "null";
            String name = NameFormatter.toDot(new QName(packageName, className));
            CommentsTable temp = classTable.get(name);
            return new ArrayList<DocComment>(temp.values());
        } catch (NullPointerException e)
        {
            return null;   //if a given class/package do not exist
View Full Code Here

TOP

Related Classes of flex2.compiler.util.QName

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.