Files
sdk/compiler/lib/error.dart
T
mmendez@google.com fc7390d97b Add support for --enable_type_checks (developer mode) for dartc.
This patch is based on https://chromereviews.googleplex.com/3520019/.  However it addresses the following issues:

1) TypeError exceptions will now have the stack trace filled in.
2) Type parameters are now accessible from closurized code, including the trampoline shims for named optinal parameters.
3) Suppress use of FunctionExpressionInliner with type checks because the inline normalization can leave return nodes in the AST.
4) Pass the generateHumanReadableOutput flag to the closure backend.
5) TypeDartcTest passes in debug and release modes with type checking enabled.  We still need to enable the additional cases in the code.

Review URL: https://chromereviews.googleplex.com/3558021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@271 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-08 04:11:34 +00:00

35 lines
866 B
Dart

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Exceptions thrown by the VM -- user code should never throw these directly.
// TODO(jat): these should be compatible with the definitions in runtime/lib/error.dart
class AssertionError {
const AssertionError();
String toString() {
return "Failed assertion";
}
}
class TypeError extends AssertionError {
final String dstType;
final String srcType;
const TypeError(this.srcType, this.dstType);
String toString() {
return "Failed type check: type $srcType is not assignable to type $dstType";
}
}
class FallThroughError {
const FallThroughError();
String toString() {
return "Switch case fall-through";
}
}