enhancements to handling of lexical scoping; fixes for X10

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3110 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
dolby-oss 2008-12-02 14:08:57 +00:00
parent 309a9b6d72
commit 577d3b9875
4 changed files with 13 additions and 11 deletions

View File

@ -17,6 +17,7 @@ import com.ibm.wala.cast.ipa.callgraph.ScopeMappingInstanceKeys;
import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.JavaClass;
import com.ibm.wala.cast.loader.AstMethod;
import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
import com.ibm.wala.cast.loader.AstMethod.LexicalParent;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;

View File

@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.ir.translator.AstTranslator.AstLexicalInformation;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.cast.loader.AstClass;
import com.ibm.wala.cast.loader.AstField;
@ -118,7 +119,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
}
private void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
TypeReference[][] catchTypes, LexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
TypeReference[][] catchTypes, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new ConcreteJavaMethod(methodEntity, owner, cfg, symtab,
hasCatchBlock, catchTypes, lexicalInfo, debugInfo));
}
@ -169,7 +170,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
private final TypeReference[] exceptionTypes;
public JavaEntityMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
TypeReference[][] catchTypes, LexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
TypeReference[][] catchTypes, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
super(owner, methodEntity.getQualifiers(), cfg, symtab, MethodReference.findOrCreate(owner.getReference(), Util
.methodEntityToSelector(methodEntity)), hasCatchBlock, catchTypes, lexicalInfo, debugInfo);
this.parameterTypes = computeParameterTypes(methodEntity);
@ -280,7 +281,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
*/
public class ConcreteJavaMethod extends JavaEntityMethod {
public ConcreteJavaMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
TypeReference[][] catchTypes, LexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
TypeReference[][] catchTypes, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
super(methodEntity, owner, cfg, symtab, hasCatchBlock, catchTypes, lexicalInfo, debugInfo);
}
@ -301,13 +302,13 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
Trace.println("resolving parents of " + this);
}
if (lexicalInfo == null) {
if (lexicalInfo() == null) {
if (AstTranslator.DEBUG_LEXICAL)
Trace.println("no info");
return new LexicalParent[0];
}
final String[] parents = lexicalInfo.getScopingParents();
final String[] parents = lexicalInfo().getScopingParents();
if (parents == null) {
if (AstTranslator.DEBUG_LEXICAL)
@ -404,7 +405,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
protected abstract SourceModuleTranslator getTranslator();
public void defineFunction(CAstEntity n, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
TypeReference[][] catchTypes, LexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
TypeReference[][] catchTypes, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
((JavaClass) owner).addMethod(n, owner, cfg, symtab, hasCatchBlock, catchTypes, lexicalInfo, debugInfo);
}

View File

@ -252,7 +252,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
SymbolTable symtab,
boolean hasCatchBlock,
TypeReference[][] caughtTypes,
LexicalInformation lexicalInfo,
AstLexicalInformation lexicalInfo,
DebuggingInformation debugInfo) {
// N.B.: base class may actually ask to create a synthetic type to wrap
// code bodies, so we may see other things than TYPE_ENTITY here.

View File

@ -1097,12 +1097,12 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
return lcdNode;
}
private Node makeBreakTarget(Node loop) {
protected Node makeBreakTarget(Node loop) {
return fNodeFactory.Labeled(Position.COMPILER_GENERATED, "breakLabel" + loop.position().toString().replace('.', '_'),
fNodeFactory.Empty(Position.COMPILER_GENERATED));
}
private Node makeContinueTarget(Node loop) {
protected Node makeContinueTarget(Node loop) {
return fNodeFactory.Labeled(Position.COMPILER_GENERATED, "continueLabel" + loop.position().toString().replace('.', '_'),
fNodeFactory.Empty(Position.COMPILER_GENERATED));
}
@ -2251,10 +2251,10 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
}
}
private class LoopContext extends BreakContext {
public class LoopContext extends BreakContext {
private final Node continueTo;
protected LoopContext(WalkContext parent, String label, Node breakTo, Node continueTo) {
public LoopContext(WalkContext parent, String label, Node breakTo, Node continueTo) {
super(parent, label, breakTo);
this.continueTo = continueTo;
}