Skip to content
Snippets Groups Projects
Commit be0656bd authored by René Schöne's avatar René Schöne
Browse files

Fixed inherited scopes.

- also added hashCodes to printed ASTs
parent c31c3c87
Branches
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ aspect Shadowing { ...@@ -16,7 +16,7 @@ aspect Shadowing {
return declaration; return declaration;
} }
} }
// the look in the inherited scopes // then look in the inherited scopes
for (Scope inherited : getInheritedScopeList()) { for (Scope inherited : getInheritedScopeList()) {
Declaration shadowed = inherited.shadowedLocally(shadower); Declaration shadowed = inherited.shadowedLocally(shadower);
if (shadowed != null) { if (shadowed != null) {
......
...@@ -133,10 +133,7 @@ jastadd { ...@@ -133,10 +133,7 @@ jastadd {
} }
run { run {
mainClassName = 'org.extendj.SccChecker' mainClassName = 'org.extendj.ScopeAnalysis'
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
} }
task preprocess(type: JavaExec) { task preprocess(type: JavaExec) {
......
...@@ -2,7 +2,7 @@ aspect Debugging { ...@@ -2,7 +2,7 @@ aspect Debugging {
public String ASTNode.getASTString() { public String ASTNode.getASTString() {
String result = this.getClass().getSimpleName() + "\n"; String result = this.getClass().getSimpleName() + " (@" + this.hashCode() + ")\n";
for (java.lang.reflect.Method method : this.getClass().getMethods()) { for (java.lang.reflect.Method method : this.getClass().getMethods()) {
ASTNodeAnnotation.Token annotation = method.getAnnotation(ASTNodeAnnotation.Token.class); ASTNodeAnnotation.Token annotation = method.getAnnotation(ASTNodeAnnotation.Token.class);
...@@ -14,7 +14,8 @@ aspect Debugging { ...@@ -14,7 +14,8 @@ aspect Debugging {
} else { } else {
name += ":= "; name += ":= ";
} }
result += "|--" + name + method.invoke(this); Object methodResult = method.invoke(this);
result += "|--" + name + methodResult + (methodResult == null ? "" : " (@" + methodResult.hashCode() + ")");
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} catch (java.lang.reflect.InvocationTargetException e) { } catch (java.lang.reflect.InvocationTargetException e) {
......
...@@ -28,7 +28,12 @@ aspect ProgramToScopeTree { ...@@ -28,7 +28,12 @@ aspect ProgramToScopeTree {
if (getTypeDecl().isClassDecl()) { if (getTypeDecl().isClassDecl()) {
ClassDecl classDecl = (ClassDecl)getTypeDecl(); ClassDecl classDecl = (ClassDecl)getTypeDecl();
if (classDecl.superclass().isClassDecl() && classDecl.superclass().compilationUnit().fromSource()) { if (classDecl.superclass().isClassDecl() && classDecl.superclass().compilationUnit().fromSource()) {
addInheritedScope(((ClassDecl)classDecl.superclass()).asPackageScope()); ClassDecl superDecl = (ClassDecl)classDecl.superclass();
if (classDecl.hostPackage().equals(superDecl.hostPackage())) {
addInheritedScope(superDecl.asPackageScope());
} else {
addInheritedScope(superDecl.asProtectedScope());
}
} }
} }
super.updateInheritance(); super.updateInheritance();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment