Status: Available
Owner: ----
CC: [email protected], [email protected], [email protected]
Labels: Type-Bug Priority-Medium
New issue 4188 by [email protected]: Variable lookup in case expression in
builtin JS fails when it shouldn't
https://code.google.com/p/v8/issues/detail?id=4188
littledan found this while writing TypedArray code, I've reproduced
separately.
Apply this diff to collection.js (also available at
https://codereview.chromium.org/1187473008):
diff --git a/src/collection.js b/src/collection.js
index 8689852..dc0c29a 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -378,7 +378,15 @@ function MapSet(key, value) {
}
+var GlobalFoo = 5;
+
+
function MapHas(key) {
+ switch (key) {
+ case GlobalFoo:
+ throw 'Adam was here';
+ }
+
if (!IS_MAP(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver,
'Map.prototype.has', this);
And then build and run:
$ out/x64.release/d8 -e 'new Map().has(5)'
results in:
unnamed:1: ReferenceError: GlobalFoo is not defined
new Map().has(5)
^
ReferenceError: GlobalFoo is not defined
at Map.has (native)
at unnamed:1:11
I tried to reproduce this outside of native JS and failed. CCing some
random folks who might have a guess as to the cause (my reading of the
parser is that case "labels" are parsed just like any other expression, so
I'm at a loss for why this would fail).
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.