Skip to content

Commit 59484ca

Browse files
committed
[GR-37175] Fix NodeLibrary getScope() for BlockScopeNode.
1 parent c7c10cd commit 59484ca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/JavaScriptNode.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -418,7 +418,12 @@ final Object getScope(Frame frame, boolean nodeEnter,
418418
functionFrame = frame.materialize();
419419
}
420420
if (block instanceof BlockScopeNode) {
421-
scopeFrame = (Frame) ((BlockScopeNode) block).getBlockScope((VirtualFrame) functionFrame);
421+
Object maybeScopeFrame = ((BlockScopeNode) block).getBlockScope((VirtualFrame) functionFrame);
422+
if (maybeScopeFrame instanceof Frame) {
423+
scopeFrame = (Frame) maybeScopeFrame;
424+
} else {
425+
scopeFrame = functionFrame;
426+
}
422427
} else {
423428
scopeFrame = functionFrame;
424429
}

0 commit comments

Comments
 (0)