Chromium Code Reviews| 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 #ifndef VM_EXCEPTIONS_H_ | 5 #ifndef VM_EXCEPTIONS_H_ |
| 6 #define VM_EXCEPTIONS_H_ | 6 #define VM_EXCEPTIONS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 static void ReThrow(const Instance& exception, const Instance& stacktrace); | 30 static void ReThrow(const Instance& exception, const Instance& stacktrace); |
| 31 static void PropagateError(const Error& error); | 31 static void PropagateError(const Error& error); |
| 32 | 32 |
| 33 // Helpers to create and throw errors. | 33 // Helpers to create and throw errors. |
| 34 static RawScript* GetCallerScript(DartFrameIterator* iterator); | 34 static RawScript* GetCallerScript(DartFrameIterator* iterator); |
| 35 static RawInstance* NewInstance(const char* class_name); | 35 static RawInstance* NewInstance(const char* class_name); |
| 36 static void SetField(const Instance& instance, | 36 static void SetField(const Instance& instance, |
| 37 const Class& cls, | 37 const Class& cls, |
| 38 const char* field_name, | 38 const char* field_name, |
| 39 const Object& value); | 39 const Object& value); |
| 40 static void SetLocationFields(const Instance& instance, | 40 static intptr_t SetLocationFields(const Array& args, |
| 41 const Class& cls, | 41 intptr_t index, |
| 42 const Script& script, | 42 const Script& script, |
| 43 intptr_t location); | 43 intptr_t location); |
|
siva
2013/07/12 16:49:36
This method not needed anymore....
floitsch
2013/07/12 17:12:36
Done.
| |
| 44 static void CreateAndThrowTypeError(intptr_t location, | 44 static void CreateAndThrowTypeError(intptr_t location, |
| 45 const String& src_type_name, | 45 const String& src_type_name, |
| 46 const String& dst_type_name, | 46 const String& dst_type_name, |
| 47 const String& dst_name, | 47 const String& dst_name, |
| 48 const String& malformed_error); | 48 const String& malformed_error); |
| 49 | 49 |
| 50 enum ExceptionType { | 50 enum ExceptionType { |
| 51 kNone, | 51 kNone, |
| 52 kRange, | 52 kRange, |
| 53 kArgument, | 53 kArgument, |
| 54 kNoSuchMethod, | 54 kNoSuchMethod, |
| 55 kFormat, | 55 kFormat, |
| 56 kUnsupported, | 56 kUnsupported, |
| 57 kStackOverflow, | 57 kStackOverflow, |
| 58 kOutOfMemory, | 58 kOutOfMemory, |
| 59 kInternalError, | 59 kInternalError, |
| 60 kNullThrown, | 60 kNullThrown, |
| 61 kIsolateSpawn, | 61 kIsolateSpawn, |
| 62 kIsolateUnhandledException, | 62 kIsolateUnhandledException, |
| 63 kFiftyThreeBitOverflowError, | 63 kFiftyThreeBitOverflowError, |
| 64 kAssertion, | |
| 65 kCast, | |
| 66 kType, | |
| 67 kFallThrough, | |
| 68 kAbstractClassInstantiation, | |
| 64 }; | 69 }; |
| 65 | 70 |
| 66 static void ThrowByType(ExceptionType type, const Array& arguments); | 71 static void ThrowByType(ExceptionType type, const Array& arguments); |
| 67 static void ThrowOOM(); | 72 static void ThrowOOM(); |
| 68 static void ThrowStackOverflow(); | 73 static void ThrowStackOverflow(); |
| 69 | 74 |
| 70 // Returns a RawInstance if the exception is successfully created, | 75 // Returns a RawInstance if the exception is successfully created, |
| 71 // otherwise returns a RawError. | 76 // otherwise returns a RawError. |
| 72 static RawObject* Create(ExceptionType type, const Array& arguments); | 77 static RawObject* Create(ExceptionType type, const Array& arguments); |
| 73 | 78 |
| 74 private: | 79 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 80 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
| 76 }; | 81 }; |
| 77 | 82 |
| 78 } // namespace dart | 83 } // namespace dart |
| 79 | 84 |
| 80 #endif // VM_EXCEPTIONS_H_ | 85 #endif // VM_EXCEPTIONS_H_ |
| OLD | NEW |