summaryrefslogtreecommitdiff
path: root/deps/v8/test/preparser
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-12-05 16:29:01 -0800
committerRyan Dahl <ry@tinyclouds.org>2011-12-05 16:29:01 -0800
commit21d081fd7f83aa168ea0bef0870c7f1fed410a63 (patch)
tree23a04eef49364b1cbee204a87fd0904be2430c2e /deps/v8/test/preparser
parente90623edc2befb06602ff8c3e01809ba0a21d593 (diff)
downloadnode-new-21d081fd7f83aa168ea0bef0870c7f1fed410a63.tar.gz
Upgrade V8 to 3.7.12
Diffstat (limited to 'deps/v8/test/preparser')
-rw-r--r--deps/v8/test/preparser/strict-identifiers.pyt55
1 files changed, 55 insertions, 0 deletions
diff --git a/deps/v8/test/preparser/strict-identifiers.pyt b/deps/v8/test/preparser/strict-identifiers.pyt
index 72808e25bf..aa3d5210d8 100644
--- a/deps/v8/test/preparser/strict-identifiers.pyt
+++ b/deps/v8/test/preparser/strict-identifiers.pyt
@@ -138,6 +138,38 @@ setter_arg = StrictTemplate("setter-param-$id", """
var x = {set foo($id) { }};
""")
+label_normal = Template("label-normal-$id", """
+ $id: '';
+""")
+
+label_strict = StrictTemplate("label-strict-$id", """
+ $id: '';
+""")
+
+break_normal = Template("break-normal-$id", """
+ for (;;) {
+ break $id;
+ }
+""")
+
+break_strict = StrictTemplate("break-strict-$id", """
+ for (;;) {
+ break $id;
+ }
+""")
+
+continue_normal = Template("continue-normal-$id", """
+ for (;;) {
+ continue $id;
+ }
+""")
+
+continue_strict = StrictTemplate("continue-strict-$id", """
+ for (;;) {
+ continue $id;
+ }
+""")
+
non_strict_use = Template("nonstrict-$id", """
var $id = 42;
$id++;
@@ -162,6 +194,7 @@ non_strict_use = Template("nonstrict-$id", """
function $id($id) { }
x = {$id: 42};
x = {get $id() {}, set $id(value) {}};
+ $id: '';
""")
identifier_name_source = """
@@ -197,6 +230,12 @@ for id in ["eval", "arguments"]:
prefix_var({"id": id, "op":"--", "opname":"dec"}, "strict_lhs_prefix")
postfix_var({"id": id, "op":"++", "opname":"inc"}, "strict_lhs_postfix")
postfix_var({"id": id, "op":"--", "opname":"dec"}, "strict_lhs_postfix")
+ label_normal({"id": id}, None)
+ label_strict({"id": id}, None)
+ break_normal({"id": id}, None)
+ break_strict({"id": id}, None)
+ continue_normal({"id": id}, None)
+ continue_strict({"id": id}, None)
non_strict_use({"id": id}, None)
@@ -205,10 +244,13 @@ for id in ["eval", "arguments"]:
for reserved_word in reserved_words + strict_reserved_words:
if (reserved_word in strict_reserved_words):
message = "strict_reserved_word"
+ label_message = None
elif (reserved_word == "const"):
message = "unexpected_token"
+ label_message = message
else:
message = "reserved_word"
+ label_message = message
arg_name_own({"id":reserved_word}, message)
arg_name_nested({"id":reserved_word}, message)
setter_arg({"id": reserved_word}, message)
@@ -225,6 +267,19 @@ for reserved_word in reserved_words + strict_reserved_words:
read_var({"id": reserved_word}, message)
identifier_name({"id": reserved_word}, None);
identifier_name_strict({"id": reserved_word}, None);
+ label_normal({"id": reserved_word}, label_message)
+ break_normal({"id": reserved_word}, label_message)
+ continue_normal({"id": reserved_word}, label_message)
+ if (reserved_word == "const"):
+ # The error message for this case is different because
+ # ParseLabelledStatementOrExpression will try to parse this as an expression
+ # first, effectively disallowing the use in ParseVariableDeclarations, i.e.
+ # the preparser never sees that 'const' was intended to be a label.
+ label_strict({"id": reserved_word}, "strict_const")
+ else:
+ label_strict({"id": reserved_word}, message)
+ break_strict({"id": reserved_word}, message)
+ continue_strict({"id": reserved_word}, message)
# Future reserved words in strict mode behave like normal identifiers