Skip to content
Snippets Groups Projects
Commit c8c03836 authored by Johannes Mey's avatar Johannes Mey
Browse files

fix types for which containingScope() is defined

parent a5dc053f
No related branches found
No related tags found
No related merge requests found
...@@ -68,9 +68,13 @@ aspect ProgramToScopeTree { ...@@ -68,9 +68,13 @@ aspect ProgramToScopeTree {
aspect ScopeGenerationAttributes { aspect ScopeGenerationAttributes {
// TODO this is only correct for declarations, not for all AST nodes!
/** determine the scope an AST element is contained in or belongs to.*/ /** determine the scope an AST element is contained in or belongs to.*/
inh lazy ASTNode ASTNode.containingScope(); inh lazy ASTNode TypeDecl.containingScope();
inh lazy ASTNode Block.containingScope();
inh lazy ASTNode ForStmt.containingScope();
inh lazy ASTNode EnhancedForStmt.containingScope();
inh lazy ASTNode Declarator.containingScope();
inh lazy ASTNode ParameterDeclaration.containingScope();
// contained in scope: // contained in scope:
eq Program.getChild().containingScope() = this; eq Program.getChild().containingScope() = this;
eq TypeDecl.getChild().containingScope() = this; eq TypeDecl.getChild().containingScope() = this;
......
...@@ -12,6 +12,7 @@ public abstract class ClassA { ...@@ -12,6 +12,7 @@ public abstract class ClassA {
public void methodNameA(int parameterA) { public void methodNameA(int parameterA) {
int localVarA = 1; int localVarA = 1;
int localVarB = 1; int localVarB = 1;
int localVarC = 1;
{ {
int localVarInBlockA = 2; int localVarInBlockA = 2;
...@@ -22,7 +23,7 @@ public abstract class ClassA { ...@@ -22,7 +23,7 @@ public abstract class ClassA {
class Local { class Local {
{ {
for (int localVarA = 0; localVarA < 10; localVarA++) System.out.println(localVarA); for (int localVarC = 0; localVarC < 10; localVarC++) System.out.println(localVarC);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment