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

Side by Side Diff: tests/compiler/dart2js/parser_helper.dart

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/parser_test.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library parser_helper; 5 library parser_helper;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; 9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t";
10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart";
(...skipping 14 matching lines...) Expand all
25 25
26 class LoggerCanceler implements DiagnosticListener { 26 class LoggerCanceler implements DiagnosticListener {
27 void cancel(String reason, {node, token, instruction, element}) { 27 void cancel(String reason, {node, token, instruction, element}) {
28 throw new CompilerCancelledException(reason); 28 throw new CompilerCancelledException(reason);
29 } 29 }
30 30
31 void log(message) { 31 void log(message) {
32 print(message); 32 print(message);
33 } 33 }
34 34
35 void internalErrorOnElement(element, String message) { 35 void internalError(node, String message) {
36 log(message); 36 log(message);
37 } 37 }
38 38
39 void internalError(String message, {node, token, instruction, element}) {
40 log(message);
41 }
42
43 SourceSpan spanFromSpannable(node) { 39 SourceSpan spanFromSpannable(node) {
44 throw 'unsupported operation'; 40 throw 'unsupported operation';
45 } 41 }
46 42
47 void reportMessage(SourceSpan span, Message message, kind) { 43 void reportMessage(SourceSpan span, Message message, kind) {
48 log(message); 44 log(message);
49 } 45 }
50 46
47 void reportFatalError(Spannable node,
48 MessageKind errorCode,
49 [Map arguments]) {
50 log(new Message(errorCode, arguments, false));
51 }
52
51 void reportError(Spannable node, MessageKind errorCode, [Map arguments]) { 53 void reportError(Spannable node, MessageKind errorCode, [Map arguments]) {
52 log(new Message(errorCode, arguments, false)); 54 log(new Message(errorCode, arguments, false));
53 } 55 }
54 56
55 void reportWarning(Spannable node, MessageKind errorCode, [Map arguments]) { 57 void reportWarning(Spannable node, MessageKind errorCode, [Map arguments]) {
56 log(new Message(errorCode, arguments, false)); 58 log(new Message(errorCode, arguments, false));
57 } 59 }
58 60
59 void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]) { 61 void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]) {
60 log(new Message(errorCode, arguments, false)); 62 log(new Message(errorCode, arguments, false));
61 } 63 }
62 64
65 void reportHint(Spannable node, MessageKind errorCode, [Map arguments]) {
66 log(new Message(errorCode, arguments, false));
67 }
68
63 withCurrentElement(Element element, f()) => f(); 69 withCurrentElement(Element element, f()) => f();
64 } 70 }
65 71
66 Token scan(String text) => new StringScanner.fromString(text).tokenize(); 72 Token scan(String text) => new StringScanner.fromString(text).tokenize();
67 73
68 Node parseBodyCode(String text, Function parseMethod, 74 Node parseBodyCode(String text, Function parseMethod,
69 {DiagnosticListener diagnosticHandler}) { 75 {DiagnosticListener diagnosticHandler}) {
70 Token tokens = scan(text); 76 Token tokens = scan(text);
71 if (diagnosticHandler == null) diagnosticHandler = new LoggerCanceler(); 77 if (diagnosticHandler == null) diagnosticHandler = new LoggerCanceler();
72 Uri uri = new Uri(scheme: "source"); 78 Uri uri = new Uri(scheme: "source");
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ElementListener listener = new ElementListener(compiler, unit, () => id++); 126 ElementListener listener = new ElementListener(compiler, unit, () => id++);
121 PartialParser parser = new PartialParser(listener); 127 PartialParser parser = new PartialParser(listener);
122 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); 128 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens));
123 return unit.localMembers; 129 return unit.localMembers;
124 } 130 }
125 131
126 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { 132 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) {
127 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), 133 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens),
128 diagnosticHandler: diagnosticHandler); 134 diagnosticHandler: diagnosticHandler);
129 } 135 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698