Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Reusable Analysis
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
Reusable Analysis
Commits
c8c03836
Commit
c8c03836
authored
5 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
fix types for which containingScope() is defined
parent
a5dc053f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+6
-2
6 additions, 2 deletions
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
testprograms/simpleScope/A.java
+2
-1
2 additions, 1 deletion
testprograms/simpleScope/A.java
with
8 additions
and
3 deletions
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+
6
−
2
View file @
c8c03836
...
@@ -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;
...
...
This diff is collapsed.
Click to expand it.
testprograms/simpleScope/A.java
+
2
−
1
View file @
c8c03836
...
@@ -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
localVar
A
=
0
;
localVar
A
<
10
;
localVar
A
++)
System
.
out
.
println
(
localVar
A
);
for
(
int
localVar
C
=
0
;
localVar
C
<
10
;
localVar
C
++)
System
.
out
.
println
(
localVar
C
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment