@@ -72,6 +72,7 @@ public class ScopeEnvironment implements CellFrameSlotSupplier {
72
72
73
73
public static String CLASS_VAR_PREFIX = "<>class" ;
74
74
public static String LAMBDA_NAME = "lambda" ;
75
+ public static int CLASS_VAR_PREFIX_IDX = CLASS_VAR_PREFIX .length ();
75
76
76
77
private final NodeFactory factory ;
77
78
@@ -116,21 +117,21 @@ public ScopeInfo popScope() {
116
117
String name = identifier instanceof String ? (String ) identifier : identifier .toString ();
117
118
118
119
if (localySeenVars != null ) {
119
- // remove the localy declared variable
120
+ // remove the locally declared variable
120
121
if (definingScopeKind == ScopeInfo .ScopeKind .Class && name .startsWith (CLASS_VAR_PREFIX )) {
121
- localySeenVars .remove (name .substring (7 ));
122
+ localySeenVars .remove (name .substring (CLASS_VAR_PREFIX_IDX ));
122
123
} else {
123
124
localySeenVars .remove (name );
124
125
}
125
126
}
126
127
127
128
List <ScopeInfo > usedInScopes = unresolvedVars .get (name );
128
- // was the declared varibale seen before?
129
+ // was the declared variable seen before?
129
130
if (usedInScopes != null && !(definingScopeKind == ScopeInfo .ScopeKind .Module && definingScope .findFrameSlot (name ) != null )) {
130
- // make the varible freevar and cellvar in scopes, where is used
131
+ // make the variable freevar and cellvar in scopes, where is used
131
132
List <ScopeInfo > copy = new ArrayList <>(usedInScopes );
132
133
for (ScopeInfo scope : copy ) {
133
- // we need to find out, whether the scope is a under the defing scope
134
+ // we need to find out, whether the scope is a under the defining scope
134
135
ScopeInfo tmpScope = scope ;
135
136
ScopeInfo parentDefiningScope = definingScope .getParent ();
136
137
while (tmpScope != null && tmpScope != definingScope && tmpScope != parentDefiningScope ) {
@@ -177,13 +178,13 @@ public ScopeInfo popScope() {
177
178
String name = (String ) identifier ;
178
179
if (name .startsWith (CLASS_VAR_PREFIX )) {
179
180
definingScope .getFrameDescriptor ().removeFrameSlot (identifier );
180
- name = name .substring (7 );
181
+ name = name .substring (CLASS_VAR_PREFIX_IDX );
181
182
definingScope .createSlotIfNotPresent (name );
182
183
copy = true ;
183
184
}
184
185
}
185
186
if (copy ) {
186
- // we copy it because the idexes are now wrong due the issue GR-17984
187
+ // we copy it because the indexes are now wrong due the issue GR-17984
187
188
definingScope .setFrameDescriptor (definingScope .getFrameDescriptor ().copy ());
188
189
}
189
190
}
0 commit comments