Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: src/runtime/runtime-classes.cc

Issue 2614053002: Improve error message for calling super() twice in a derived constructor (Closed)
Patch Set: Merged Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 40
41 RUNTIME_FUNCTION(Runtime_ThrowStaticPrototypeError) { 41 RUNTIME_FUNCTION(Runtime_ThrowStaticPrototypeError) {
42 HandleScope scope(isolate); 42 HandleScope scope(isolate);
43 DCHECK_EQ(0, args.length()); 43 DCHECK_EQ(0, args.length());
44 THROW_NEW_ERROR_RETURN_FAILURE( 44 THROW_NEW_ERROR_RETURN_FAILURE(
45 isolate, NewTypeError(MessageTemplate::kStaticPrototype)); 45 isolate, NewTypeError(MessageTemplate::kStaticPrototype));
46 } 46 }
47 47
48 RUNTIME_FUNCTION(Runtime_ThrowSuperAlreadyCalledError) {
49 HandleScope scope(isolate);
50 DCHECK_EQ(0, args.length());
51 THROW_NEW_ERROR_RETURN_FAILURE(
52 isolate, NewReferenceError(MessageTemplate::kSuperAlreadyCalled));
53 }
54
48 namespace { 55 namespace {
49 56
50 Object* ThrowNotSuperConstructor(Isolate* isolate, Handle<Object> constructor, 57 Object* ThrowNotSuperConstructor(Isolate* isolate, Handle<Object> constructor,
51 Handle<JSFunction> function) { 58 Handle<JSFunction> function) {
52 Handle<Object> super_name; 59 Handle<Object> super_name;
53 if (constructor->IsJSFunction()) { 60 if (constructor->IsJSFunction()) {
54 super_name = handle(Handle<JSFunction>::cast(constructor)->shared()->name(), 61 super_name = handle(Handle<JSFunction>::cast(constructor)->shared()->name(),
55 isolate); 62 isolate);
56 } else if (constructor->IsOddball()) { 63 } else if (constructor->IsOddball()) {
57 DCHECK(constructor->IsNull(isolate)); 64 DCHECK(constructor->IsNull(isolate));
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 497 }
491 498
492 // Call the constructor. 499 // Call the constructor.
493 RETURN_RESULT_OR_FAILURE( 500 RETURN_RESULT_OR_FAILURE(
494 isolate, Execution::New(isolate, constructor, new_target, result_length, 501 isolate, Execution::New(isolate, constructor, new_target, result_length,
495 construct_args.start())); 502 construct_args.start()));
496 } 503 }
497 504
498 } // namespace internal 505 } // namespace internal
499 } // namespace v8 506 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698