Skip to content

Commit

Permalink
refactor: rename getCurrentNameScope to getCurrentLexicalScope (#2857)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky authored and monperrus committed Jan 26, 2019
1 parent b2f0769 commit acedd6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/spoon/reflect/visitor/LexicalScopeScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import java.util.Deque;

/**
* Responsible for building lexical scopes.
*
* A {@link CtScanner} which provides current lexical scope
* of currently scanned AST node.
*/
public class LexicalScopeScanner extends EarlyTerminatingScanner<Object> {
private final Deque<LexicalScope> scopes = new ArrayDeque<>();
Expand All @@ -41,7 +41,7 @@ protected void exit(spoon.reflect.declaration.CtElement e) {
* @return {@link LexicalScope} of actually scanned element. The {@link LexicalScope#forEachElementByName(String, java.util.function.Function)} can be used
* to get all {@link CtElement}s which are mapped to that simple name
*/
public LexicalScope getCurrentNameScope() {
public LexicalScope getCurrentLexicalScope() {
LexicalScope ns = scopes.peek();
return ns == null ? EMPTY : ns;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public void testNameScopeScanner() throws Exception {
public ScanningMode enter(CtElement element) {
// saving the scope of method 'draw'
if (element instanceof CtBlock) {
scopes[0] = scanner.getCurrentNameScope();
scopes[0] = scanner.getCurrentLexicalScope();
}

// saving the scope at 'System.out.println("2");'
if (element instanceof CtLiteral && ((CtLiteral) element).getValue().equals("2")) {
scopes[1] = scanner.getCurrentNameScope();
scopes[1] = scanner.getCurrentLexicalScope();
}
return ScanningMode.NORMAL;
}
Expand Down

0 comments on commit acedd6c

Please sign in to comment.