system/src/sc/lang/js/JSRuntimeProcessor.java
String[] addJSLibFiles(Object type, boolean append, String rootTypeLibFile, Object fromType, DepType depType) {
      // This prefix alias attribute does not work for inner classes.
      if (ModelUtil.getEnclosingType(type) == null && append) {
         registerPrefixAlias(type);
      }

      Object settingsObj = ModelUtil.getAnnotation(type, "sc.js.JSSettings");
      boolean handled = false;
      if (settingsObj != null) {

         String typeName = ModelUtil.getTypeName(type);
         String replaceWith = (String) ModelUtil.getAnnotationValue(settingsObj, "replaceWith");
         boolean nativeReplace = false;
         if (replaceWith == null) {
            replaceWith = (String) ModelUtil.getAnnotationValue(settingsObj, "replaceWithNative");
            if (replaceWith != null && replaceWith.length() > 0)
               nativeReplace = true;
         }
         if (replaceWith != null && replaceWith.length() > 0) {
            jsBuildInfo.addReplaceType(typeName, replaceWith, nativeReplace);
            handled = true;
            if (jsBuildInfo.jsLibFilesForType.get(typeName) == null)
               jsBuildInfo.jsLibFilesForType.put(typeName, HAS_ALIAS_SENTINEL);
         }

         String jsFilesStr = (String) ModelUtil.getAnnotationValue(settingsObj, "jsLibFiles");
         if (jsFilesStr != null && jsFilesStr.length() > 0) {
            String[] newJsFiles = StringUtil.split(jsFilesStr, ',');
            for (int i = 0; i < newJsFiles.length; i++) {
               if (append) {
                  addLibFile(newJsFiles[i], rootTypeLibFile, type, fromType, depType);
               }
               else if (!jsBuildInfo.jsFiles.contains(newJsFiles[i]))
                  System.err.println("*** jsFiles for type: " + type + " not added during process phase");
            }
            jsBuildInfo.jsLibFilesForType.put(typeName, jsFilesStr);

            return newJsFiles;
         }

         //type = ModelUtil.resolveSrcTypeDeclaration(system, type);

         String jsModule = getJSModuleFile(type, true, true);
         if (jsModule != null && jsModule.length() > 0) {
            jsModule = jsModule.trim();
            if (append) {
               addLibFile(jsModule, rootTypeLibFile, type, fromType, depType);
            }
            else if (!jsBuildInfo.jsFiles.contains(jsModule))
               System.err.println("*** jsFiles for type: " + type + " not added during process phase");
         }
      }
      if (!handled) {
         String typeName = ModelUtil.getTypeName(type, false);
         if (jsBuildInfo.replaceTypes.get(typeName) != null || jsBuildInfo.replaceNativeTypes.get(typeName) != null)
            return new String[0];
         return null;
      }
      return new String[0];
   }
/**
    * This method walks through the type dependency tree for all types compiled for the JS process.
    * It gets called in two modes - first during start to collect the
    * jsLibFiles for each type and populate the jsLibFiles in the build info.  This is with (append=true).
    * It later is called from the getProcessedFiles method (append=false) to copy the files for a given type.
    */
This method walks through the type dependency tree for all types compiled for the JS process.
It gets called in two modes - first during start to collect the
jsLibFiles for each type and populate the jsLibFiles in the build info.  This is with (append=true).
It later is called from the getProcessedFiles method (append=false) to copy the files for a given type.
This method walks through the type dependency tree for all types compiled for the JS process . It gets called in two modes - first during start to collect the jsLibFiles for each type and populate the jsLibFiles in the build info . This is with ( append = true ) . It later is called from the getProcessedFiles method ( append = false ) to copy the files for a given type .
String[] addJSLibFiles(Object type, boolean append, String rootTypeLibFile, Object fromType, DepType depType) {
      if (ModelUtil.getEnclosingType(type) == null && append) {
         registerPrefixAlias(type);
      }
      Object settingsObj = ModelUtil.getAnnotation(type, "sc.js.JSSettings");
      boolean handled = false;
      if (settingsObj != null) {
         String typeName = ModelUtil.getTypeName(type);
         String replaceWith = (String) ModelUtil.getAnnotationValue(settingsObj, "replaceWith");
         boolean nativeReplace = false;
         if (replaceWith == null) {
            replaceWith = (String) ModelUtil.getAnnotationValue(settingsObj, "replaceWithNative");
            if (replaceWith != null && replaceWith.length() > 0)
               nativeReplace = true;
         }
         if (replaceWith != null && replaceWith.length() > 0) {
            jsBuildInfo.addReplaceType(typeName, replaceWith, nativeReplace);
            handled = true;
            if (jsBuildInfo.jsLibFilesForType.get(typeName) == null)
               jsBuildInfo.jsLibFilesForType.put(typeName, HAS_ALIAS_SENTINEL);
         }
         String jsFilesStr = (String) ModelUtil.getAnnotationValue(settingsObj, "jsLibFiles");
         if (jsFilesStr != null && jsFilesStr.length() > 0) {
            String[] newJsFiles = StringUtil.split(jsFilesStr, ',');
            for (int i = 0; i < newJsFiles.length; i++) {
               if (append) {
                  addLibFile(newJsFiles[i], rootTypeLibFile, type, fromType, depType);
               }
               else if (!jsBuildInfo.jsFiles.contains(newJsFiles[i]))
                  System.err.println("*** jsFiles for type: " + type + " not added during process phase");
            }
            jsBuildInfo.jsLibFilesForType.put(typeName, jsFilesStr);
            return newJsFiles;
         }
         String jsModule = getJSModuleFile(type, true, true);
         if (jsModule != null && jsModule.length() > 0) {
            jsModule = jsModule.trim();
            if (append) {
               addLibFile(jsModule, rootTypeLibFile, type, fromType, depType);
            }
            else if (!jsBuildInfo.jsFiles.contains(jsModule))
               System.err.println("*** jsFiles for type: " + type + " not added during process phase");
         }
      }
      if (!handled) {
         String typeName = ModelUtil.getTypeName(type, false);
         if (jsBuildInfo.replaceTypes.get(typeName) != null || jsBuildInfo.replaceNativeTypes.get(typeName) != null)
            return new String[0];
         return null;
      }
      return new String[0];
   }
String [ ] addJSLibFiles ( Object type , boolean append , String rootTypeLibFile , Object fromType , DepType depType ) { if ( ModelUtil . getEnclosingType ( type ) == null && append ) { registerPrefixAlias ( type ) ; } Object settingsObj = ModelUtil . getAnnotation ( type , "sc.js.JSSettings" ) ; boolean handled = false ; if ( settingsObj != null ) { String typeName = ModelUtil . getTypeName ( type ) ; String replaceWith = ( String ) ModelUtil . getAnnotationValue ( settingsObj , "replaceWith" ) ; boolean nativeReplace = false ; if ( replaceWith == null ) { replaceWith = ( String ) ModelUtil . getAnnotationValue ( settingsObj , "replaceWithNative" ) ; if ( replaceWith != null && replaceWith . length ( ) > 0 ) nativeReplace = true ; } if ( replaceWith != null && replaceWith . length ( ) > 0 ) { jsBuildInfo . addReplaceType ( typeName , replaceWith , nativeReplace ) ; handled = true ; if ( jsBuildInfo . jsLibFilesForType . get ( typeName ) == null ) jsBuildInfo . jsLibFilesForType . put ( typeName , HAS_ALIAS_SENTINEL ) ; } String jsFilesStr = ( String ) ModelUtil . getAnnotationValue ( settingsObj , "jsLibFiles" ) ; if ( jsFilesStr != null && jsFilesStr . length ( ) > 0 ) { String [ ] newJsFiles = StringUtil . split ( jsFilesStr , ',' ) ; for ( int i = 0 ; i < newJsFiles . length ; i ++ ) { if ( append ) { addLibFile ( newJsFiles [ i ] , rootTypeLibFile , type , fromType , depType ) ; } else if ( ! jsBuildInfo . jsFiles . contains ( newJsFiles [ i ] ) ) System . err . println ( "*** jsFiles for type: " + type + " not added during process phase" ) ; } jsBuildInfo . jsLibFilesForType . put ( typeName , jsFilesStr ) ; return newJsFiles ; } String jsModule = getJSModuleFile ( type , true , true ) ; if ( jsModule != null && jsModule . length ( ) > 0 ) { jsModule = jsModule . trim ( ) ; if ( append ) { addLibFile ( jsModule , rootTypeLibFile , type , fromType , depType ) ; } else if ( ! jsBuildInfo . jsFiles . contains ( jsModule ) ) System . err . println ( "*** jsFiles for type: " + type + " not added during process phase" ) ; } } if ( ! handled ) { String typeName = ModelUtil . getTypeName ( type , false ) ; if ( jsBuildInfo . replaceTypes . get ( typeName ) != null || jsBuildInfo . replaceNativeTypes . get ( typeName ) != null ) return new String [ 0 ] ; return null ; } return new String [ 0 ] ; }
This method walks through the type dependency tree for all types compiled for the JS process.
This method walks through the type dependency tree for all types compiled for the JS process .
// This prefix alias attribute does not work for inner classes. //type = ModelUtil.resolveSrcTypeDeclaration(system, type);