// 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"],
}
} 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;
}
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --harmony-classes
+'use strict';
+
+class C {
+ get constructor() {}
+}
--- /dev/null
+# Copyright 2014 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+*%(basename)s:9: SyntaxError: Class constructor may not be an accessor
+ get constructor() {}
+ ^^^^^^^^^^^
+SyntaxError: Class constructor may not be an accessor
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --harmony-classes
+'use strict';
+
+class C {
+ *constructor() {}
+}
--- /dev/null
+# Copyright 2014 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+*%(basename)s:9: SyntaxError: Class constructor may not be a generator
+ *constructor() {}
+ ^^^^^^^^^^^
+SyntaxError: Class constructor may not be a generator