dart-sdk/runtime/lib
Matthias Hausner 3e0d13bc28 Make compile-time errors catchable
If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.

The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#

Example:
     1	void bad() {
     2	    return 5
     3	}
     4
     5	void main(args) {
     6	    bad();
     7	}

Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^
$

After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^

#0      main (file:///Users/hausner/tmp/e.dart:6:3)
#1      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$

Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.

BUG= https://github.com/dart-lang/sdk/issues/23684
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2044753002 .
2016-09-16 10:10:38 -07:00
..
array.cc Update range errors to agree on the numbers. 2015-09-11 13:05:36 +02:00
array.dart VM: Remove use of IterableMixinWorkaround from _List, _ImmutableList and _GrowableList. 2014-12-02 10:38:51 +00:00
array_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
async_patch.dart Fix problem occurring when an async* stream is paused at the end of a yield*. 2016-09-01 11:03:35 +02:00
async_sources.gypi - Move timer implementation closer to the rest of message handling. 2015-01-28 00:39:35 +00:00
bigint.dart Sped up hashCode by removing megamorphic call to _identityHashCode. 2016-07-08 15:19:55 -07:00
bool.cc Support 'dart.library.X' env variables in the VM. 2016-02-29 20:58:32 +01:00
bool_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
class_id.cc Keep zone cached in SnapshotReader to allow removing ZoneHandle(Isolate*) interface. 2015-03-19 17:42:40 +00:00
class_id.dart Optimize List.toList/.sublist and List.from on lists. 2014-08-27 08:00:48 +00:00
collection_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
collection_sources.gypi VM-internalize the default Map implementation. 2015-05-28 09:32:54 -07:00
compact_hash.dart VM: New, faster default Map construction. 2016-08-25 17:51:45 -07:00
convert_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
convert_sources.gypi Made old dart:json library use convert to parse JSON. 2013-08-28 07:56:12 +00:00
core_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
core_sources.gypi Remove deprecated Resource class from dart:core. 2016-08-26 11:58:04 +02:00
date.cc Fix core lib DateTime in the VM (fixes #19923). 2016-03-30 10:09:58 -07:00
date_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
deferred_load_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
developer.cc More changes to use #ifndef PRODUCT ... #endif explicitly instead of relying on compiler magic. 2016-07-14 11:13:13 -07:00
developer.dart Use metadata annotation @patch for patch classes 2016-08-09 09:48:03 -07:00
developer_sources.gypi Add Timeline to dart:developer 2015-10-01 09:30:47 -07:00
double.cc Remove support for pretenuring as it is not fully implemented and is currently turned on for a very specific case (double to string for one byte strings). 2016-07-01 12:59:19 -07:00
double.dart Introduce getter p on double in the VM to control fractional precision. 2016-08-04 15:18:00 -07:00
double_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
empty_source.dart - Split Dart core libraries into shared sources and patch sources. 2012-08-13 23:01:20 +00:00
errors.cc Simplify generated code for assert() 2016-06-16 10:44:30 -07:00
errors_patch.dart Make compile-time errors catchable 2016-09-16 10:10:38 -07:00
expando_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
function.cc RELOAD: Check if an implicit closure needs rebinding at compile time and adjust closure equality. 2016-07-27 16:51:11 -07:00
function.dart Remove signature classes from the VM. 2016-01-19 16:32:59 -08:00
function_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
growable_array.cc Update range errors to agree on the numbers. 2015-09-11 13:05:36 +02:00
growable_array.dart - Fix for issue 27054 (leak when removing element from _GrowableList) 2016-08-12 16:06:12 -07:00
identical.cc Remove more things 2016-02-22 08:53:11 -08:00
identical_patch.dart Use metadata annotation @patch for patch classes 2016-08-09 09:48:03 -07:00
immutable_map.dart Remove stale comment in ImmutableList implementation 2016-01-22 15:53:07 -08:00
integers.cc vm: Generate 'and' instruction for Smi values. 2016-07-04 16:27:57 -07:00
integers.dart Sped up hashCode by removing megamorphic call to _identityHashCode. 2016-07-08 15:19:55 -07:00
integers_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
internal_patch.dart AOT: Use a cid range check when possible to implement type tests. 2016-09-08 15:25:08 -07:00
internal_sources.gypi Add VM internal Dart class 'ClassID' used to manage class-ids of known classes. Next CL: add constant fields corresponding to each class id (smiCid, oneByteStringCid, etc). 2014-06-20 20:56:55 +00:00
invocation_mirror.h Better error message for assignment to final local variables 2014-02-25 18:01:35 +00:00
invocation_mirror_patch.dart Spec says empty namedArguments is const {}, not const <Symbol, dynamic>{}. 2015-09-18 17:05:35 -07:00
isolate.cc JIT precompilated snapshots. 2016-05-04 18:47:36 -07:00
isolate_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
isolate_sources.gypi - Move timer implementation closer to the rest of message handling. 2015-01-28 00:39:35 +00:00
lib_prefix.dart Fix checked mode error 2016-06-08 07:34:55 -07:00
libgen_in.cc - Include sources in gen_snapshot and dart_no_snapshot to allow 2015-11-17 14:58:09 -08:00
linked_hash_map.cc VM: New, faster default Map construction. 2016-08-25 17:51:45 -07:00
map_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
math.cc Use symbols when looking up fields in a class 2016-04-07 16:36:35 -07:00
math_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
math_sources.gypi - Move MathNatives from dart:core to dart:math. 2012-11-16 19:42:02 +00:00
mirror_reference.dart Syntax fix. 2013-09-20 15:54:10 +00:00
mirrors.cc Minor cleanup based on profiler output of CompileParseFunction. 2016-05-04 15:30:56 -07:00
mirrors.h Support isExternal method on MethodMirror in the Dart VM. Not really intended for public consumption. switch to using isExternal and using anonymous. 2015-10-29 19:17:08 -07:00
mirrors_impl.dart - reset 'dirty' flag to false after the libraries mirrors is computed, this ensures that we compute the libraries only when new library modules are loaded and the 'dirty' flag is set to true. 2016-04-29 15:15:19 -07:00
mirrors_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
mirrors_sources.gypi Add a VM defined class VMReference as an opaque pointer for Dart code to VM internal objects. 2013-07-02 16:17:25 +00:00
null_patch.dart Use metadata annotation @patch for patch classes 2016-08-09 09:48:03 -07:00
object.cc Made simple instance-of checks fast for unoptimized code. 2016-07-14 11:11:17 -07:00
object_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
print_patch.dart Use metadata annotation @patch for patch classes 2016-08-09 09:48:03 -07:00
profiler.cc Deprecate 'dart:profiler' and move functionality to 'dart:developer' 2015-05-18 11:31:20 -07:00
profiler.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
profiler_sources.gypi Revert "Remove deprecated dart:profiler library" 2015-11-04 01:59:53 +01:00
regexp.cc - Refactor Symbol allocation to expect a thread parameter. 2016-04-11 16:28:29 -07:00
regexp_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
schedule_microtask_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
simd128.cc Update range errors to agree on the numbers. 2015-09-11 13:05:36 +02:00
stacktrace.cc Optimize AOT's switchable calls for the monomorphic case. 2016-08-12 11:18:35 -07:00
stacktrace.dart - Simplify collection of stack traces. If we determine that a stack 2015-02-19 02:18:53 +00:00
stacktrace.h Print stack trace when Dart_SetReturnValue is passed UnwindError. 2016-02-01 10:46:49 -08:00
stopwatch.cc Refactor monotonic clock interface and use raw tick values in stopwatch 2016-01-05 11:22:20 -08:00
stopwatch_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
string.cc Remove support for pretenuring as it is not fully implemented and is currently turned on for a very specific case (double to string for one byte strings). 2016-07-01 12:59:19 -07:00
string_buffer_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
string_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
symbol_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
timeline.cc More #ifndef PRODUCT changes. 2016-07-14 18:27:55 -07:00
timeline.dart Use metadata annotation @patch for patch classes 2016-08-09 09:48:03 -07:00
timer_impl.dart Use a monotonic clock in the implementation of Timer. 2015-12-11 12:39:56 -08:00
timer_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
type_patch.dart Remove recently introduced FunctionType vm class by merging it into class Type. 2016-03-21 14:08:57 -07:00
typed_data.cc Remove unused external typed data factories. 2016-08-25 10:29:17 -07:00
typed_data.dart Don't cache the cid of CodeUnits. 2016-08-29 09:21:06 -07:00
typed_data_sources.gypi Rename dart:typeddata to dart:typed_data. 2013-04-23 11:54:54 +00:00
uri.cc Add property base to the Uri class 2013-09-25 13:52:15 +00:00
uri_patch.dart Reapply fast-URI patch. 2016-08-17 10:54:24 +02:00
vmservice.cc Fix issue 27006 (safepoint assertion failure). 2016-08-03 14:28:41 -07:00
vmservice_patch.dart Implement @patch annotation for patch class members 2016-08-10 12:54:57 -07:00
vmservice_sources.gypi Properly split dart:_vmservice across sdk and runtime 2015-10-07 13:19:55 -07:00
weak_property.cc Rename GET_NATIVE_ARGUMENT macro to GET_NON_NULL_NATIVE_ARGUMENT. 2012-12-10 17:59:40 +00:00
weak_property.dart Get rid of a lot of () for getters. 2012-09-07 11:50:07 +00:00