OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/pending-compilation-error-handler.h" | 5 #include "src/pending-compilation-error-handler.h" |
6 | 6 |
7 #include "src/debug.h" | 7 #include "src/debug.h" |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } else if (!handle_arg_.is_null()) { | 29 } else if (!handle_arg_.is_null()) { |
30 elements->set(0, *handle_arg_); | 30 elements->set(0, *handle_arg_); |
31 } | 31 } |
32 isolate->debug()->OnCompileError(script); | 32 isolate->debug()->OnCompileError(script); |
33 | 33 |
34 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); | 34 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); |
35 Handle<Object> error; | 35 Handle<Object> error; |
36 | 36 |
37 switch (error_type_) { | 37 switch (error_type_) { |
38 case kReferenceError: | 38 case kReferenceError: |
39 error = factory->NewReferenceError(message_, array); | 39 error = factory->NewError("MakeReferenceError", message_, array); |
40 break; | 40 break; |
41 case kSyntaxError: | 41 case kSyntaxError: |
42 error = factory->NewSyntaxError(message_, array); | 42 error = factory->NewError("MakeSyntaxError", message_, array); |
43 break; | 43 break; |
44 } | 44 } |
45 | 45 |
46 Handle<JSObject> jserror = Handle<JSObject>::cast(error); | 46 Handle<JSObject> jserror = Handle<JSObject>::cast(error); |
47 | 47 |
48 Handle<Name> key_start_pos = factory->error_start_pos_symbol(); | 48 Handle<Name> key_start_pos = factory->error_start_pos_symbol(); |
49 JSObject::SetProperty(jserror, key_start_pos, | 49 JSObject::SetProperty(jserror, key_start_pos, |
50 handle(Smi::FromInt(location.start_pos()), isolate), | 50 handle(Smi::FromInt(location.start_pos()), isolate), |
51 SLOPPY).Check(); | 51 SLOPPY).Check(); |
52 | 52 |
53 Handle<Name> key_end_pos = factory->error_end_pos_symbol(); | 53 Handle<Name> key_end_pos = factory->error_end_pos_symbol(); |
54 JSObject::SetProperty(jserror, key_end_pos, | 54 JSObject::SetProperty(jserror, key_end_pos, |
55 handle(Smi::FromInt(location.end_pos()), isolate), | 55 handle(Smi::FromInt(location.end_pos()), isolate), |
56 SLOPPY).Check(); | 56 SLOPPY).Check(); |
57 | 57 |
58 Handle<Name> key_script = factory->error_script_symbol(); | 58 Handle<Name> key_script = factory->error_script_symbol(); |
59 JSObject::SetProperty(jserror, key_script, script, SLOPPY).Check(); | 59 JSObject::SetProperty(jserror, key_script, script, SLOPPY).Check(); |
60 | 60 |
61 isolate->Throw(*error, &location); | 61 isolate->Throw(*error, &location); |
62 } | 62 } |
63 } | 63 } |
64 } // namespace v8::internal | 64 } // namespace v8::internal |
OLD | NEW |