Skip to content

Commit

Permalink
Revert "[truffle] Remove null checks for something that is never a nu…
Browse files Browse the repository at this point in the history
…ll now"

Doesn't really pass :(

This reverts commit d696271.
  • Loading branch information
pmurias committed Sep 24, 2018
1 parent d696271 commit 651bb3a
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/vm/jvm/runtime/org/perl6/nqp/truffle/NQPScopeWithFrame.java
Expand Up @@ -92,7 +92,11 @@ public FoundLexical findLexical(String name, int depth) {
FrameSlot found = frameDescriptor.findFrameSlot(name);

if (found == null) {
return outer.findLexical(name, depth + 1);
if (outer != null) {
return outer.findLexical(name, depth + 1);
} else {
throw new RuntimeException("Can't find lexical: " + name);
}
}
return new FoundLexical(found, depth);
}
Expand Down Expand Up @@ -124,22 +128,38 @@ public FrameSlot getContextSlot() {

@Override
public HLL getCurrentHLL() {
return outer.getCurrentHLL();
if (outer != null) {
return outer.getCurrentHLL();
} else {
throw new RuntimeException("Can't get current HLL");
}
}

@Override
public GlobalContext getGlobalContext() {
return outer.getGlobalContext();
if (outer != null) {
return outer.getGlobalContext();
} else {
throw new RuntimeException("Can't get HLLs");
}
}

@Override
public NQPCodeRef getCuid(String cuid) {
return outer.getCuid(cuid);
if (outer != null) {
return outer.getCuid(cuid);
} else {
throw new RuntimeException("Can't get cuid");
}
}

@Override
public void addCuid(String cuid, NQPCodeRef codeRef) {
outer.addCuid(cuid, codeRef);
if (outer != null) {
outer.addCuid(cuid, codeRef);
} else {
throw new RuntimeException("Can't add cuid");
}
}
}

0 comments on commit 651bb3a

Please sign in to comment.