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

Side by Side Diff: runtime/vm/exceptions.h

Issue 2044753002: Make compile-time errors catchable (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 4 years, 3 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/exceptions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/token_position.h" 9 #include "vm/token_position.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 // Forward declarations. 13 // Forward declarations.
14 class AbstractType; 14 class AbstractType;
15 class Array; 15 class Array;
16 class DartFrameIterator; 16 class DartFrameIterator;
17 class Error; 17 class Error;
18 class LanguageError;
18 class Instance; 19 class Instance;
19 class Integer; 20 class Integer;
20 class RawInstance; 21 class RawInstance;
21 class RawObject; 22 class RawObject;
22 class RawScript; 23 class RawScript;
23 class RawStacktrace; 24 class RawStacktrace;
24 class String; 25 class String;
25 class Thread; 26 class Thread;
26 27
27 class Exceptions : AllStatic { 28 class Exceptions : AllStatic {
(...skipping 25 matching lines...) Expand all
53 kStackOverflow, 54 kStackOverflow,
54 kOutOfMemory, 55 kOutOfMemory,
55 kNullThrown, 56 kNullThrown,
56 kIsolateSpawn, 57 kIsolateSpawn,
57 kAssertion, 58 kAssertion,
58 kCast, 59 kCast,
59 kType, 60 kType,
60 kFallThrough, 61 kFallThrough,
61 kAbstractClassInstantiation, 62 kAbstractClassInstantiation,
62 kCyclicInitializationError, 63 kCyclicInitializationError,
64 kCompileTimeError,
63 }; 65 };
64 66
65 static void ThrowByType(ExceptionType type, const Array& arguments); 67 static void ThrowByType(ExceptionType type, const Array& arguments);
66 // Uses the preallocated out of memory exception to avoid calling 68 // Uses the preallocated out of memory exception to avoid calling
67 // into Dart code or allocating any code. 69 // into Dart code or allocating any code.
68 static void ThrowOOM(); 70 static void ThrowOOM();
69 static void ThrowStackOverflow(); 71 static void ThrowStackOverflow();
70 static void ThrowArgumentError(const Instance& arg); 72 static void ThrowArgumentError(const Instance& arg);
71 static void ThrowRangeError(const char* argument_name, 73 static void ThrowRangeError(const char* argument_name,
72 const Integer& argument_value, 74 const Integer& argument_value,
73 intptr_t expected_from, 75 intptr_t expected_from,
74 intptr_t expected_to); 76 intptr_t expected_to);
77 static void ThrowCompileTimeError(const LanguageError& error);
75 78
76 // Returns a RawInstance if the exception is successfully created, 79 // Returns a RawInstance if the exception is successfully created,
77 // otherwise returns a RawError. 80 // otherwise returns a RawError.
78 static RawObject* Create(ExceptionType type, const Array& arguments); 81 static RawObject* Create(ExceptionType type, const Array& arguments);
79 82
80 private: 83 private:
81 DISALLOW_COPY_AND_ASSIGN(Exceptions); 84 DISALLOW_COPY_AND_ASSIGN(Exceptions);
82 }; 85 };
83 86
84 } // namespace dart 87 } // namespace dart
85 88
86 #endif // VM_EXCEPTIONS_H_ 89 #endif // VM_EXCEPTIONS_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/exceptions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698