| 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/cpu.h" | 7 #include "vm/cpu.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 ASSERT(result.IsInstance()); | 291 ASSERT(result.IsInstance()); |
| 292 Instance& exception = Instance::Handle(); | 292 Instance& exception = Instance::Handle(); |
| 293 exception ^= result.raw(); | 293 exception ^= result.raw(); |
| 294 Throw(exception); | 294 Throw(exception); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 | 298 |
| 299 RawObject* Exceptions::Create( | 299 RawObject* Exceptions::Create( |
| 300 ExceptionType type, const GrowableArray<const Object*>& arguments) { | 300 ExceptionType type, const GrowableArray<const Object*>& arguments) { |
| 301 Library& library = Library::Handle(); |
| 301 String& class_name = String::Handle(); | 302 String& class_name = String::Handle(); |
| 302 switch (type) { | 303 switch (type) { |
| 303 case kIndexOutOfRange: | 304 case kIndexOutOfRange: |
| 305 library = Library::CoreLibrary(); |
| 304 class_name = String::NewSymbol("IndexOutOfRangeException"); | 306 class_name = String::NewSymbol("IndexOutOfRangeException"); |
| 305 break; | 307 break; |
| 306 case kIllegalArgument: | 308 case kIllegalArgument: |
| 309 library = Library::CoreLibrary(); |
| 307 class_name = String::NewSymbol("IllegalArgumentException"); | 310 class_name = String::NewSymbol("IllegalArgumentException"); |
| 308 break; | 311 break; |
| 309 case kNoSuchMethod: | 312 case kNoSuchMethod: |
| 313 library = Library::CoreLibrary(); |
| 310 class_name = String::NewSymbol("NoSuchMethodException"); | 314 class_name = String::NewSymbol("NoSuchMethodException"); |
| 311 break; | 315 break; |
| 312 case kClosureArgumentMismatch: | 316 case kClosureArgumentMismatch: |
| 317 library = Library::CoreLibrary(); |
| 313 class_name = String::NewSymbol("ClosureArgumentMismatchException"); | 318 class_name = String::NewSymbol("ClosureArgumentMismatchException"); |
| 314 break; | 319 break; |
| 315 case kObjectNotClosure: | 320 case kObjectNotClosure: |
| 321 library = Library::CoreLibrary(); |
| 316 class_name = String::NewSymbol("ObjectNotClosureException"); | 322 class_name = String::NewSymbol("ObjectNotClosureException"); |
| 317 break; | 323 break; |
| 318 case kBadNumberFormat: | 324 case kBadNumberFormat: |
| 325 library = Library::CoreLibrary(); |
| 319 class_name = String::NewSymbol("BadNumberFormatException"); | 326 class_name = String::NewSymbol("BadNumberFormatException"); |
| 320 break; | 327 break; |
| 321 case kStackOverflow: | 328 case kStackOverflow: |
| 329 library = Library::CoreLibrary(); |
| 322 class_name = String::NewSymbol("StackOverflowException"); | 330 class_name = String::NewSymbol("StackOverflowException"); |
| 323 break; | 331 break; |
| 324 case kOutOfMemory: | 332 case kOutOfMemory: |
| 333 library = Library::CoreLibrary(); |
| 325 class_name = String::NewSymbol("OutOfMemoryException"); | 334 class_name = String::NewSymbol("OutOfMemoryException"); |
| 326 break; | 335 break; |
| 327 case kWrongArgumentCount: | 336 case kWrongArgumentCount: |
| 337 library = Library::CoreLibrary(); |
| 328 class_name = String::NewSymbol("WrongArgumentCountException"); | 338 class_name = String::NewSymbol("WrongArgumentCountException"); |
| 329 break; | 339 break; |
| 330 case kInternalError: | 340 case kInternalError: |
| 341 library = Library::CoreLibrary(); |
| 331 class_name = String::NewSymbol("InternalError"); | 342 class_name = String::NewSymbol("InternalError"); |
| 332 break; | 343 break; |
| 333 case kNullPointer: | 344 case kNullPointer: |
| 345 library = Library::CoreLibrary(); |
| 334 class_name = String::NewSymbol("NullPointerException"); | 346 class_name = String::NewSymbol("NullPointerException"); |
| 335 break; | 347 break; |
| 336 case kIllegalJSRegExp: | 348 case kIllegalJSRegExp: |
| 349 library = Library::CoreLibrary(); |
| 337 class_name = String::NewSymbol("IllegalJSRegExpException"); | 350 class_name = String::NewSymbol("IllegalJSRegExpException"); |
| 338 break; | 351 break; |
| 352 case kIsolateSpawn: |
| 353 library = Library::IsolateLibrary(); |
| 354 class_name = String::NewSymbol("IsolateSpawnException"); |
| 355 break; |
| 339 } | 356 } |
| 340 | 357 |
| 341 return DartLibraryCalls::ExceptionCreate(class_name, arguments); | 358 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
| 342 } | 359 } |
| 343 | 360 |
| 344 } // namespace dart | 361 } // namespace dart |
| OLD | NEW |