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

Unified Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10662055: Add bailouts to dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/backend.dart
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index 45f0db10473e61a9ac9e52607baf8fade64fcd51..77fb893676bd15ea9ac260f85f8aee99029e312c 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -2,6 +2,12 @@
// 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.
+class BailoutException {
+ final String reason;
+
+ const BailoutException(this.reason);
+}
+
class DartBackend extends Backend {
final List<CompilerTask> tasks;
final UnparseValidator unparseValidator;
@@ -30,7 +36,23 @@ class DartBackend extends Backend {
resolvedElements.forEach((element, treeElements) {
unparseValidator.check(element);
});
- compiler.assembledCode = '';
+
+ // TODO(antonm): Eventually bailouts will be proper errors.
+ void bailout(String reason) {
+ throw new BailoutException(reason);
+ }
+
+ try {
+ resolvedElements.forEach((element, treeElements) {
+ bailout('I can do nothing right now.');
+ });
+ } catch (BailoutException e) {
+ compiler.assembledCode = '''
+main() {
+ final bailout_reason = "${e.reason}";
+}
+''';
+ }
}
log(String message) => compiler.log('[DartBackend] $message');
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698