Reviewers: ,
Message:
I dunno if anyone has an opinion on this, but I think it's weird to say
"constructor can't be an accessor" when it's not.
Description:
[parser] better error message for generator constructors
BUG=
Please review this at https://codereview.chromium.org/982153003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+5, -2 lines):
M src/messages.js
M src/preparser.h
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index
ba739987897417c7917901659d68f892cc8fe0ac..f0e71d9578db50cdd27eb56e3ab9db3b4d3653aa
100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -8,7 +8,8 @@ var kMessages = {
// Error
cyclic_proto: ["Cyclic __proto__ value"],
code_gen_from_strings: ["%0"],
- constructor_special_method: ["Class constructor may not be an
accessor"],
+ constructor_is_generator: ["Class constructor may not be a
generator"],
+ constructor_is_accessor: ["Class constructor may not be an
accessor"],
// TypeError
generator_running: ["Generator is already running"],
unexpected_token: ["Unexpected token ", "%0"],
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index
4a35cd59f52dfa71426abc71f58937ce3d783f86..7df271f6baad4152aa359f3377e6d5609b97bbe6
100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -3106,7 +3106,9 @@ void
ParserBase<Traits>::ClassLiteralChecker::CheckProperty(
}
} else if (IsConstructor()) {
if (is_generator || type == kAccessorProperty) {
- this->parser()->ReportMessage("constructor_special_method");
+ const char* msg =
+
is_generator ? "constructor_is_generator" : "constructor_is_accessor";
+ this->parser()->ReportMessage(msg);
*ok = false;
return;
}
--
--
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.