From 651bb3a1b1ffb273ba345ae55f734941206586f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Murias?= Date: Mon, 24 Sep 2018 21:19:10 +0200 Subject: [PATCH] Revert "[truffle] Remove null checks for something that is never a null now" Doesn't really pass :( This reverts commit d696271314b8a145cef68040dc26abed225b5198. --- .../perl6/nqp/truffle/NQPScopeWithFrame.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/vm/jvm/runtime/org/perl6/nqp/truffle/NQPScopeWithFrame.java b/src/vm/jvm/runtime/org/perl6/nqp/truffle/NQPScopeWithFrame.java index a58784ab78..2610d8ae5b 100644 --- a/src/vm/jvm/runtime/org/perl6/nqp/truffle/NQPScopeWithFrame.java +++ b/src/vm/jvm/runtime/org/perl6/nqp/truffle/NQPScopeWithFrame.java @@ -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); } @@ -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"); + } } }