Skip to content

Commit

Permalink
Define LocalScope.empty for really empty scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Aug 28, 2024
1 parent fdcd78c commit 88ecb93
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ class LocalScope(
}
}
object LocalScope {
val empty: LocalScope = {
val graph = new AliasGraph
val info = DataflowAnalysis.DependencyInfo()
val emptyVariableNames = new FramePointerAnalysis.FramePointerMeta(null, Some(List()))
new LocalScope(
None,
() => graph,
() => graph.rootScope,
() => info,
() => emptyVariableNames
)
}

/** Constructs a local scope for an [[EnsoRootNode]].
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public AtomConstructor initializeFields(
return initializeFields(
language,
null,
LocalScope.root(),
LocalScope.empty(),
scopeBuilder,
new ExpressionNode[0],
reads,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class GetFieldNode extends EnsoRootNode {
* @param index the index this node should use for field lookup.
*/
GetFieldNode(EnsoLanguage language, int index, Type type, String name, ModuleScope moduleScope) {
super(language, LocalScope.root(), moduleScope, name, null);
super(language, LocalScope.empty(), moduleScope, name, null);
this.index = index;
this.type = type;
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class QualifiedAccessorNode extends EnsoRootNode {
EnsoLanguage language, AtomConstructor atomConstructor, ModuleScope moduleScope) {
super(
language,
LocalScope.root(),
LocalScope.empty(),
moduleScope,
atomConstructor.getQualifiedName().toString(),
null);
Expand Down

0 comments on commit 88ecb93

Please sign in to comment.