File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -142,12 +142,14 @@ public FrameSlot findFrameSlot(String identifier) {
142
142
return this .getFrameDescriptor ().findFrameSlot (identifier );
143
143
}
144
144
145
- private void createSlotIfNotPresent (String identifier ) {
145
+ FrameSlot createSlotIfNotPresent (String identifier ) {
146
146
assert identifier != null : "identifier is null!" ;
147
147
FrameSlot frameSlot = this .getFrameDescriptor ().findFrameSlot (identifier );
148
148
if (frameSlot == null ) {
149
149
identifierToIndex .add (identifier );
150
- this .getFrameDescriptor ().addFrameSlot (identifier );
150
+ return getFrameDescriptor ().addFrameSlot (identifier );
151
+ } else {
152
+ return frameSlot ;
151
153
}
152
154
}
153
155
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ public void createLocal(String name) {
180
180
}
181
181
182
182
private FrameSlot createAndReturnLocal (String name ) {
183
- return currentScope .getFrameDescriptor (). findOrAddFrameSlot (name );
183
+ return currentScope .createSlotIfNotPresent (name );
184
184
}
185
185
186
186
private boolean isCellInCurrentScope (String name ) {
@@ -349,7 +349,7 @@ public static FrameSlot makeTempLocalVariable(FrameDescriptor frameDescriptor) {
349
349
350
350
private void createGlobal (String name ) {
351
351
assert name != null : "name is null!" ;
352
- globalScope .getFrameDescriptor (). findOrAddFrameSlot (name );
352
+ globalScope .createSlotIfNotPresent (name );
353
353
}
354
354
355
355
public void addLocalGlobals (String name ) {
@@ -399,7 +399,7 @@ protected ReadDefaultArgumentNode[] getDefaultArgumentReads() {
399
399
}
400
400
401
401
public FrameSlot getReturnSlot () {
402
- return currentScope .getFrameDescriptor (). findOrAddFrameSlot (RETURN_SLOT_ID );
402
+ return currentScope .createSlotIfNotPresent (RETURN_SLOT_ID );
403
403
}
404
404
405
405
private ScopeInfo findEnclosingClassScope () {
You can’t perform that action at this time.
0 commit comments