minor cleanups

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3265 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2009-03-09 17:59:09 +00:00
parent c567aefe65
commit aeda43e97e
9 changed files with 33 additions and 54 deletions

View File

@ -1,6 +1,5 @@
source.test.jar = harness-src/,\
examples-src/
output.test.jar = bin/
bin.includes = plugin.xml,\
test.jar,\
bin.includes = test.jar,\
META-INF/

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
</plugin>

View File

@ -1,6 +1,5 @@
output.js.jar = bin/
bin.includes = plugin.xml,\
lib/js.jar,\
bin.includes = lib/js.jar,\
lib/xalan.jar,\
.,\
META-INF/,\

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
</plugin>

View File

@ -893,7 +893,7 @@ public class RhinoToAstTranslator {
case Token.FINALLY:
case Token.BLOCK:
case Token.LABEL: {
CAstNode ast;
// CAstNode ast;
Node c1 = n.getFirstChild();
if (c1 != null && c1.getType() == Token.SWITCH) {
Node switchValue = c1.getFirstChild();
@ -1027,7 +1027,7 @@ public class RhinoToAstTranslator {
}
case Token.VAR: {
List<CAstNode> result = new ArrayList();
List<CAstNode> result = new ArrayList<CAstNode>();
Node nm = n.getFirstChild();
while (nm != null) {
context.addInitializer(Ast.makeNode(CAstNode.DECL_STMT, Ast.makeConstant(new CAstSymbolImpl(nm.getString())),

View File

@ -45,7 +45,6 @@ public abstract class AbstractEntity implements CAstEntity {
}
}
@SuppressWarnings("unused")
public void addScopedEntity(CAstNode construct, CAstEntity child) {
if (!scopedEntities.containsKey(construct)) {
Collection<CAstEntity> set = HashSetFactory.make(1);

View File

@ -3611,7 +3611,7 @@ public abstract class AstTranslator extends CAstVisitor implements ArrayOpHandle
public void translate(final CAstEntity N, final String nm) {
if (DEBUG_TOP)
Trace.println("translating " + nm);
this.inlinedSourceMap = inlinedSourceMap;
// this.inlinedSourceMap = inlinedSourceMap;
walkEntities(N, new DefaultContext(this, N, nm));
}

View File

@ -31,7 +31,6 @@ public abstract class NativeTranslatorToCAst
return sourceFileName;
}
@SuppressWarnings("unused")
protected String getFile() {
return sourceURL.getFile();
}

View File

@ -29,7 +29,7 @@ import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
public CAstAbstractModuleLoader(IClassHierarchy cha, IClassLoader parent) {
super(cha, parent);
}
@ -38,11 +38,10 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
this(cha, null);
}
protected abstract TranslatorToCAst
getTranslatorToCAst(CAst ast, URL sourceURL, String localFileName);
protected abstract TranslatorToCAst getTranslatorToCAst(CAst ast, URL sourceURL, String localFileName);
protected abstract boolean shouldTranslate(CAstEntity entity);
protected abstract TranslatorToIR initTranslator();
protected void finishTranslation() {
@ -52,7 +51,7 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
public void init(final List<Module> modules) {
final CAst ast = new CAstImpl();
final Set topLevelEntities = new LinkedHashSet();
final Set<Pair> topLevelEntities = new LinkedHashSet<Pair>();
final TranslatorToIR xlatorToIR = initTranslator();
@ -66,24 +65,23 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
String fn = f.toString();
try {
TranslatorToCAst xlatorToCAst =
getTranslatorToCAst(ast, new URL("file://" + f), fn);
TranslatorToCAst xlatorToCAst = getTranslatorToCAst(ast, new URL("file://" + f), fn);
CAstEntity fileEntity = xlatorToCAst.translateToCAst();
if (fileEntity != null) {
CAstPrinter.printTo(fileEntity, Trace.getTraceWriter());
if (fileEntity != null) {
CAstPrinter.printTo(fileEntity, Trace.getTraceWriter());
topLevelEntities.add(Pair.make(fileEntity, fn));
}
topLevelEntities.add(Pair.make(fileEntity, fn));
}
} catch (MalformedURLException e) {
Trace.println("unpected problems with " + f);
e.printStackTrace( Trace.getTraceStream() );
e.printStackTrace(Trace.getTraceStream());
Assertions.UNREACHABLE();
} catch (RuntimeException e) {
Trace.println("unpected problems with " + f);
e.printStackTrace( Trace.getTraceStream() );
}
e.printStackTrace(Trace.getTraceStream());
}
} else if (moduleEntry instanceof SourceURLModule) {
java.net.URL url = ((SourceURLModule) moduleEntry).getURL();
@ -91,29 +89,27 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
String localFileName = fileName.replace('/', '_');
try {
File F = TemporaryFile.streamToFile(localFileName,
((SourceURLModule) moduleEntry).getInputStream());
File F = TemporaryFile.streamToFile(localFileName, ((SourceURLModule) moduleEntry).getInputStream());
final TranslatorToCAst xlatorToCAst =
getTranslatorToCAst(ast, url, localFileName);
final TranslatorToCAst xlatorToCAst = getTranslatorToCAst(ast, url, localFileName);
CAstEntity fileEntity = xlatorToCAst.translateToCAst();
if (fileEntity != null) {
Trace.println(CAstPrinter.print(fileEntity));
if (fileEntity != null) {
Trace.println(CAstPrinter.print(fileEntity));
topLevelEntities.add(Pair.make(fileEntity, fileName));
}
topLevelEntities.add(Pair.make(fileEntity, fileName));
}
F.delete();
} catch (IOException e) {
Trace.println("unexpected problems with " + fileName);
e.printStackTrace( Trace.getTraceStream() );
e.printStackTrace(Trace.getTraceStream());
Assertions.UNREACHABLE();
} catch (RuntimeException e) {
Trace.println("unexpected problems with " + fileName);
e.printStackTrace( Trace.getTraceStream() );
}
e.printStackTrace(Trace.getTraceStream());
}
}
}
@ -128,12 +124,12 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
init((Module) mes.next());
}
for(Iterator tles = topLevelEntities.iterator(); tles.hasNext(); ) {
Pair p = (Pair)tles.next();
if (shouldTranslate((CAstEntity)p.fst)) {
xlatorToIR.translate((CAstEntity)p.fst, (String)p.snd);
}
}
for (Iterator tles = topLevelEntities.iterator(); tles.hasNext();) {
Pair p = (Pair) tles.next();
if (shouldTranslate((CAstEntity) p.fst)) {
xlatorToIR.translate((CAstEntity) p.fst, (String) p.snd);
}
}
}
}
@ -142,8 +138,7 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
for (Iterator ts = types.keySet().iterator(); ts.hasNext();) {
TypeName tn = (TypeName) ts.next();
try {
Trace.println("found type " + tn + " : " + types.get(tn) + " < "
+ ((IClass) types.get(tn)).getSuperclass());
Trace.println("found type " + tn + " : " + types.get(tn) + " < " + ((IClass) types.get(tn)).getSuperclass());
} catch (Exception e) {
System.err.println(e);
}