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) {
142142 return this .getFrameDescriptor ().findFrameSlot (identifier );
143143 }
144144
145- private void createSlotIfNotPresent (String identifier ) {
145+ FrameSlot createSlotIfNotPresent (String identifier ) {
146146 assert identifier != null : "identifier is null!" ;
147147 FrameSlot frameSlot = this .getFrameDescriptor ().findFrameSlot (identifier );
148148 if (frameSlot == null ) {
149149 identifierToIndex .add (identifier );
150- this .getFrameDescriptor ().addFrameSlot (identifier );
150+ return getFrameDescriptor ().addFrameSlot (identifier );
151+ } else {
152+ return frameSlot ;
151153 }
152154 }
153155
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ public void createLocal(String name) {
180180 }
181181
182182 private FrameSlot createAndReturnLocal (String name ) {
183- return currentScope .getFrameDescriptor (). findOrAddFrameSlot (name );
183+ return currentScope .createSlotIfNotPresent (name );
184184 }
185185
186186 private boolean isCellInCurrentScope (String name ) {
@@ -349,7 +349,7 @@ public static FrameSlot makeTempLocalVariable(FrameDescriptor frameDescriptor) {
349349
350350 private void createGlobal (String name ) {
351351 assert name != null : "name is null!" ;
352- globalScope .getFrameDescriptor (). findOrAddFrameSlot (name );
352+ globalScope .createSlotIfNotPresent (name );
353353 }
354354
355355 public void addLocalGlobals (String name ) {
@@ -399,7 +399,7 @@ protected ReadDefaultArgumentNode[] getDefaultArgumentReads() {
399399 }
400400
401401 public FrameSlot getReturnSlot () {
402- return currentScope .getFrameDescriptor (). findOrAddFrameSlot (RETURN_SLOT_ID );
402+ return currentScope .createSlotIfNotPresent (RETURN_SLOT_ID );
403403 }
404404
405405 private ScopeInfo findEnclosingClassScope () {
You can’t perform that action at this time.
0 commit comments