Package flex2.compiler

Examples of flex2.compiler.Source


        Set<String> s = new TreeSet<String>();
            Set externs = configuration.getExterns();

        for (int i = 0, size = sources.size(); i < size; i++)
        {
          Source src = sources.get(i);
          CompilationUnit unit = src == null ? null : src.getCompilationUnit();
          if (unit != null && !PreLink.isCompilationUnitExternal(unit, externs) &&
              !src.isInternal())
          {
            s.addAll(unit.resourceBundleHistory);
          }
        }

        for (int i = 0, size = defaults == null ? 0 : defaults.size(); i < size; i++)
        {
          s.add(defaults.get(i));
        }

        for (Iterator i = s.iterator(); i.hasNext(); )
        {
          String rbName = NameFormatter.toColon((String) i.next());
          QName qName = new QName(rbName);

          VirtualFile[] files = bundlePath.findVirtualFiles(rbName);

          if (files == null)
          {
            files = swcContext.getVirtualFiles(locales, qName.getNamespace(), qName.getLocalPart());
          }

                if (files == null)
                {
                    // Handle Flex 2 style precompiled resource bundles.
                    QName precompiledQName = new QName(rbName + I18nUtils.CLASS_SUFFIX);
                    Source source = swcContext.getSource(precompiledQName.getNamespace(),
                                                         precompiledQName.getLocalPart());

                    if (source != null)
                    {
                        //FIXME I don't know if this logic is correct or possible.
View Full Code Here


                                swcContext,
                                true);
        }

        String generatedLoaderFile = rootClassName + ".as";
        Source s = new Source(new TextFile(sourceText,
                                                generatedLoaderFile,
                                                null,
                                                MimeMappings.getMimeType(generatedLoaderFile)),
                               "", rootClassName, null, false, false, false);
        // C: It doesn't look like this Source needs any path resolution. null is fine...
        s.setPathResolver(null);
        sources.add(resources.addResource(s));
        configuration.setRootClassName(rootClassName);

        if (configuration.getCompilerConfiguration().keepGeneratedActionScript())
        {
View Full Code Here

      CompilationUnit main = null;

        for (int i = 0, length = units.size(); i < length; i++)
        {
            CompilationUnit u = units.get(i);
            Source s = u.getSource();
            String path = s.getName();

          if (!u.isRoot())
          {
            // C: should also setup dependencies based on CompilationUnit.inheritance...
            //    it still works because the list is already sorted and this is a SimpleMovie!
View Full Code Here

      //  NOTE Here we watch for specific generated loose code units we have carnal knowledge of, and add their
      //  definitions as deps to the main unit.
      //   TODO Remove once serverconfigdata is handled within the standard bootstrap setup.
      //
            Source source = unit.getSource();
      String sourceName = source.getName();

            if (sourceName.equals("serverConfigData.as"))
            {
                serverConfigDef = unit.topLevelDefinitions.first().toString();
            }
            CULinkable linkable = new CULinkable( unit );
            if (unit.isRoot())
                mainLinkable = linkable;

            if (source.isInternal())
            {
                externs.addAll( unit.topLevelDefinitions.getStringSet() );
            }

            linkables.add( linkable );           
        }

        frames = new ArrayList<Frame>();

        // FIXME - hook serverconfigdata to FlexInit mixin
    if (mainLinkable != null)
    {
            if (serverConfigDef != null)
                mainLinkable.addDep(serverConfigDef);
    }

        try
        {
            final Set<SwcLibrary> librariesProcessed = new HashSet<SwcLibrary>();
            int counter = 0;
            DependencyWalker.LinkState state = new DependencyWalker.LinkState( linkables, externs, includes, unresolved );
            for (Iterator<FrameInfo> it = frameInfoList.iterator(); it.hasNext();)
            {
                FramesConfiguration.FrameInfo frameInfo = it.next();
                final Frame f = new Frame();
              f.pos = ++counter;

                if (frameInfo.label != null)
                {
                    f.label = new FrameLabel();
                    f.label.label = frameInfo.label;
                }

                // note that we only allow externs on the last frame
                DependencyWalker.traverse( frameInfo.frameClasses, state, !it.hasNext(), !it.hasNext(),
                                           getInheritanceDependenciesOnly(),
                                           new Visitor<Linkable>()
                {
                    public void visit( Linkable o )
                    {
                        // FIXME - keep an eye on those lazy abcs... do we have loose script?
            //  TODO yep! delete "false &&" once loose-script bootstrapping code has been eliminated - see note above
                        CULinkable l = (CULinkable) o;
                        // exportUnitOnFrame( l.getUnit(), f, false);// && !l.hasDefinition( frameClass ) );
                      exportUnitOnFrame( l.getUnit(), f, lazyInit);
                       
                        // for any scripts that we include from libraries, add the libraries keep-as3-metadata
                        // to the list of metadata we will preserve in postlink.
                        Source source = l.getUnit().getSource();
                        if (source.isSwcScriptOwner() && !source.isInternal())
                        {
                            SwcScript script = (SwcScript)source.getOwner();
                            SwcLibrary library = script.getLibrary();
                
                            // lots of scripts, but not many swcs, so avoid adding the same metadata
                            // over and over.
                            if (!librariesProcessed.contains(library))
View Full Code Here

    final Map<QName, String> qnames = new HashMap<QName, String>(); // QName, VirtualFile.getName()

        for (int i = 0, length = units.size(); i < length; i++)
        {
            CompilationUnit u = units.get(i);
            Source s = u.getSource();
            String path = s.getName();

            dependencies.put(path, u);
      if (!dependencies.containsVertex(s.getName()))
      {
        dependencies.addVertex(new Vertex<String,CompilationUnit>(path));
      }
       
      // register QName --> VirtualFile.getName()
      for (Iterator<QName> j = u.topLevelDefinitions.iterator(); j.hasNext();)
      {
        qnames.put(j.next(), s.getName());
      }
        }

    // setup inheritance-based dependencies...
    for (int i = 0, size = units.size(); i < size; i++)
    {
            CompilationUnit u = units.get(i);
            Source s = u.getSource();
            String head = s.getName();

      for (Name name : u.inheritance)
      {
        if (name instanceof QName)
        {
View Full Code Here

        if (units != null)
        {
            swcDefSignatureChecksums = new HashMap<QName, Long>();
            for (CompilationUnit unit : units)
            {
                Source source = unit == null ? null : unit.getSource();
                if (source != null && source.isSwcScriptOwner() && !source.isInternal())
                {
                    addSignatureChecksumToData(unit);
                }               
            }
          }
View Full Code Here

                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());
                    }
                }
                if (Trace.swcChecksum)
                {
                    if (dataSignatureChecksum == null)
View Full Code Here

                        String packageName = NameFormatter.retrievePackageName(className);
                        String leafName = NameFormatter.retrieveClassName(className);
                        if (! mappings.isLookupOnly(nsTarget, className) || includeAllForAsdoc)
                        {
                            // Check SourceList before SourcePath to avoid duplicate Source objects.
                            Source s = sourceList.findSource(packageName, leafName);

                            if (s == null)
                            {
                                s = sourcePath.findSource(packageName, leafName);
                            }

                            if (s == null)
                            {
                              // if includeAllForAsdoc is set to true then don't generate an exception if the source is not found.
                              // there are cases when flash classes are listed in the manifest but the source is not available
                              // (or is not organized in folders as should be by package)
                              if(includeAllForAsdoc)
                              {
                                continue;
                              }
                             
                                SwcException e = new SwcException.NoSourceForClass( className, nsTarget );
                                ThreadLocalToolkit.log(e);
                                throw e;
                            }
                            classes.put(s.getName(), s);

                            SwcComponent component = new SwcComponent(className, compName, nsTarget);
                            nsComponents.add(component);
                        }
                        else if (includeLookupOnly)
View Full Code Here

                    String tempName = className.replace('/', '.').replace('\\', '.');
                    String packageName = NameFormatter.retrievePackageName(tempName);
                    String leafName = NameFormatter.retrieveClassName(tempName);

                    // Check SourceList before SourcePath to avoid duplicate Source objects.
                    Source s = sourceList.findSource(packageName, leafName);
                   
                    if (s == null)
                    {
                        s = sourcePath.findSource(packageName, leafName);
                    }

                    if (s == null)
                    {
                        SwcException msg;
                        if (className.endsWith(".as") || className.endsWith(".mxml"))
                        {
                            msg = new SwcException.CouldNotFindFileSource(className);
                        }
                        else
                        {
                            msg = new SwcException.CouldNotFindSource(className);
                        }
                        ThreadLocalToolkit.log(msg);
                        throw msg;
                    }
                    classes.put(s.getName(), s);
                }
            }
            catch(CompilerException ce)
            {
                ThreadLocalToolkit.logError(ce.getMessage());
View Full Code Here

        QName qName = findQName(multiName);

        if (qName != null)
        {
            Source source = symbolTable.findSourceByQName(qName);

            interfaceInfo = interfaceInfoMap.get( qName.toString() );

            if (interfaceInfo == null)
            {
                CompilationUnit compilationUnit = source.getCompilationUnit();

                if (compilationUnit != null)
                {
                    AbcClass abcClass = compilationUnit.classTable.get( qName.toString() );
View Full Code Here

TOP

Related Classes of flex2.compiler.Source

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.