Skip to content

Commit 0049539

Browse files
committed
Revert "Revert "[truffle] Remove null checks for something that is never a null now""
This reverts commit 651bb3a.
1 parent 09439dd commit 0049539

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

src/vm/jvm/runtime/org/perl6/nqp/truffle/NQPScopeWithFrame.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ public FoundLexical findLexical(String name, int depth) {
9292
FrameSlot found = frameDescriptor.findFrameSlot(name);
9393

9494
if (found == null) {
95-
if (outer != null) {
96-
return outer.findLexical(name, depth + 1);
97-
} else {
98-
throw new RuntimeException("Can't find lexical: " + name);
99-
}
95+
return outer.findLexical(name, depth + 1);
10096
}
10197
return new FoundLexical(found, depth);
10298
}
@@ -128,38 +124,22 @@ public FrameSlot getContextSlot() {
128124

129125
@Override
130126
public HLL getCurrentHLL() {
131-
if (outer != null) {
132-
return outer.getCurrentHLL();
133-
} else {
134-
throw new RuntimeException("Can't get current HLL");
135-
}
127+
return outer.getCurrentHLL();
136128
}
137129

138130
@Override
139131
public GlobalContext getGlobalContext() {
140-
if (outer != null) {
141-
return outer.getGlobalContext();
142-
} else {
143-
throw new RuntimeException("Can't get HLLs");
144-
}
132+
return outer.getGlobalContext();
145133
}
146134

147135
@Override
148136
public NQPCodeRef getCuid(String cuid) {
149-
if (outer != null) {
150-
return outer.getCuid(cuid);
151-
} else {
152-
throw new RuntimeException("Can't get cuid");
153-
}
137+
return outer.getCuid(cuid);
154138
}
155139

156140
@Override
157141
public void addCuid(String cuid, NQPCodeRef codeRef) {
158-
if (outer != null) {
159-
outer.addCuid(cuid, codeRef);
160-
} else {
161-
throw new RuntimeException("Can't add cuid");
162-
}
142+
outer.addCuid(cuid, codeRef);
163143
}
164144
}
165145

0 commit comments

Comments
 (0)