OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 "package:compiler/src/elements/elements.dart"; | 9 import "package:compiler/src/elements/elements.dart"; |
10 import 'package:compiler/src/id_generator.dart'; | 10 import 'package:compiler/src/id_generator.dart'; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 @override | 86 @override |
87 DiagnosticMessage createMessage( | 87 DiagnosticMessage createMessage( |
88 Spannable spannable, | 88 Spannable spannable, |
89 MessageKind messageKind, | 89 MessageKind messageKind, |
90 [Map arguments = const {}]) { | 90 [Map arguments = const {}]) { |
91 return new DiagnosticMessage( | 91 return new DiagnosticMessage( |
92 null, spannable, | 92 null, spannable, |
93 new Message(MessageTemplate.TEMPLATES[messageKind], arguments, false)); | 93 new Message(MessageTemplate.TEMPLATES[messageKind], arguments, false)); |
94 } | 94 } |
| 95 |
| 96 @override |
| 97 bool get hasReportedError => false; |
95 } | 98 } |
96 | 99 |
97 Token scan(String text) => | 100 Token scan(String text) => |
98 new StringScanner.fromString(text) | 101 new StringScanner.fromString(text) |
99 .tokenize(); | 102 .tokenize(); |
100 | 103 |
101 Node parseBodyCode(String text, Function parseMethod, | 104 Node parseBodyCode(String text, Function parseMethod, |
102 {DiagnosticReporter reporter}) { | 105 {DiagnosticReporter reporter}) { |
103 Token tokens = scan(text); | 106 Token tokens = scan(text); |
104 if (reporter == null) reporter = new LoggerCanceler(); | 107 if (reporter == null) reporter = new LoggerCanceler(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 162 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
160 return unit.localMembers; | 163 return unit.localMembers; |
161 } | 164 } |
162 | 165 |
163 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { | 166 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { |
164 return parseBodyCode( | 167 return parseBodyCode( |
165 source, | 168 source, |
166 (parser, tokens) => parser.parseUnit(tokens), | 169 (parser, tokens) => parser.parseUnit(tokens), |
167 reporter: reporter); | 170 reporter: reporter); |
168 } | 171 } |
OLD | NEW |