@Test
 public void testProjectScope() throws IOException, CoreException {
   IJavaScriptProject p =
       JavaScriptHeadlessUtil.getJavaScriptProjectFromWorkspace(project.projectName);
   JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
   AnalysisScope s =
       makeProjectPath(p)
           .toAnalysisScope(
               new CAstAnalysisScope(
                   JSCallGraphUtil.makeLoaders(), Collections.singleton(JavaScriptLoader.JS)));
   System.err.println(s);
   Assert.assertTrue("cannot make scope", s != null);
   Assert.assertFalse("cannot find files", s.getModules(JavaScriptTypes.jsLoader).isEmpty());
 }
Esempio n. 2
0
  @Override
  protected IClassLoader makeNewClassLoader(
      ClassLoaderReference classLoaderReference,
      IClassHierarchy cha,
      IClassLoader parent,
      AnalysisScope scope)
      throws IOException {
    if (classLoaderReference.equals(JavaScriptTypes.jsLoader)) {
      JavaScriptLoader L = new JavaScriptLoader(cha, jsTranslatorFactory);
      L.init(scope.getModules(classLoaderReference));
      return L;

    } else {
      return super.makeNewClassLoader(classLoaderReference, cha, parent, scope);
    }
  }