OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/exceptions.h" | 5 #include "vm/exceptions.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 SetField(type_error, cls, "malformedError", malformed_error); | 300 SetField(type_error, cls, "malformedError", malformed_error); |
301 | 301 |
302 // Type errors in the core library may be difficult to diagnose. | 302 // Type errors in the core library may be difficult to diagnose. |
303 // Print type error information before throwing the error when debugging. | 303 // Print type error information before throwing the error when debugging. |
304 if (FLAG_print_stacktrace_at_throw) { | 304 if (FLAG_print_stacktrace_at_throw) { |
305 if (!malformed_error.IsNull()) { | 305 if (!malformed_error.IsNull()) { |
306 OS::Print("%s\n", malformed_error.ToCString()); | 306 OS::Print("%s\n", malformed_error.ToCString()); |
307 } | 307 } |
308 intptr_t line, column; | 308 intptr_t line, column; |
309 script.GetTokenLocation(location, &line, &column); | 309 script.GetTokenLocation(location, &line, &column); |
310 OS::Print("'%s': Failed type check: line %d pos %d: ", | 310 OS::Print("'%s': Failed type check: line %"Pd" pos %"Pd": ", |
311 String::Handle(script.url()).ToCString(), line, column); | 311 String::Handle(script.url()).ToCString(), line, column); |
312 if (!dst_name.IsNull() && (dst_name.Length() > 0)) { | 312 if (!dst_name.IsNull() && (dst_name.Length() > 0)) { |
313 OS::Print("type '%s' is not a subtype of type '%s' of '%s'.\n", | 313 OS::Print("type '%s' is not a subtype of type '%s' of '%s'.\n", |
314 src_type_name.ToCString(), | 314 src_type_name.ToCString(), |
315 dst_type_name.ToCString(), | 315 dst_type_name.ToCString(), |
316 dst_name.ToCString()); | 316 dst_name.ToCString()); |
317 } else { | 317 } else { |
318 OS::Print("malformed type used.\n", | 318 OS::Print("malformed type used.\n"); |
319 String::Handle(script.url()).ToCString(), | |
320 line, column); | |
321 } | 319 } |
322 } | 320 } |
323 // Throw TypeError instance. | 321 // Throw TypeError instance. |
324 Exceptions::Throw(type_error); | 322 Exceptions::Throw(type_error); |
325 UNREACHABLE(); | 323 UNREACHABLE(); |
326 } | 324 } |
327 | 325 |
328 | 326 |
329 void Exceptions::Throw(const Instance& exception) { | 327 void Exceptions::Throw(const Instance& exception) { |
330 Isolate* isolate = Isolate::Current(); | 328 Isolate* isolate = Isolate::Current(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 case kIsolateSpawn: | 432 case kIsolateSpawn: |
435 library = Library::IsolateLibrary(); | 433 library = Library::IsolateLibrary(); |
436 class_name = Symbols::New("IsolateSpawnException"); | 434 class_name = Symbols::New("IsolateSpawnException"); |
437 break; | 435 break; |
438 } | 436 } |
439 | 437 |
440 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); | 438 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
441 } | 439 } |
442 | 440 |
443 } // namespace dart | 441 } // namespace dart |
OLD | NEW |