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

Side by Side Diff: pkg/fasta/lib/src/kernel/body_builder.dart

Issue 2649923002: Update listener error handling. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « pkg/dart_parser/lib/src/parser.dart ('k') | pkg/fasta/lib/src/source/diet_parser.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) 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 fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import 'package:dart_parser/src/parser.dart' show 7 import 'package:dart_parser/src/parser.dart' show
8 FormalParameterType, 8 FormalParameterType,
9 optional; 9 optional;
10 10
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 reportErrorToken(token); 2150 reportErrorToken(token);
2151 do { 2151 do {
2152 token = token.next; 2152 token = token.next;
2153 } while (token is ErrorToken); 2153 } while (token is ErrorToken);
2154 return token; 2154 return token;
2155 } 2155 }
2156 const List<String> trailing = const <String>[")", "}", ";", ","]; 2156 const List<String> trailing = const <String>[")", "}", ";", ","];
2157 if (trailing.contains(token.stringValue) && trailing.contains(string)) { 2157 if (trailing.contains(token.stringValue) && trailing.contains(string)) {
2158 // We're just trying to get out an error. 2158 // We're just trying to get out an error.
2159 if (recoverableErrors.isNotEmpty) { 2159 if (recoverableErrors.isNotEmpty) {
2160 reportError(token, ErrorKind.UNSPECIFIED, 2160 reportError(token, ErrorKind.Unspecified,
2161 {"text": "Expected: '$string', but got '${token.value}'"}); 2161 {"text": "Expected: '$string', but got '${token.value}'"});
2162 } 2162 }
2163 return token; 2163 return token;
2164 } 2164 }
2165 return super.expected(string, token); 2165 return super.expected(string, token);
2166 } 2166 }
2167 2167
2168 void warning(error, [int charOffset = -1]) { 2168 void warning(error, [int charOffset = -1]) {
2169 String message = new InputError(uri, charOffset, error).format(); 2169 String message = new InputError(uri, charOffset, error).format();
2170 print(message); 2170 print(message);
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 } else if (node is TypeDeclarationBuilder) { 2644 } else if (node is TypeDeclarationBuilder) {
2645 return node.name; 2645 return node.name;
2646 } else if (node is PrefixBuilder) { 2646 } else if (node is PrefixBuilder) {
2647 return node.name; 2647 return node.name;
2648 } else if (node is ThisPropertyAccessor) { 2648 } else if (node is ThisPropertyAccessor) {
2649 return node.name.name; 2649 return node.name.name;
2650 } else { 2650 } else {
2651 return internalError("Unhandled: ${node.runtimeType}"); 2651 return internalError("Unhandled: ${node.runtimeType}");
2652 } 2652 }
2653 } 2653 }
OLDNEW
« no previous file with comments | « pkg/dart_parser/lib/src/parser.dart ('k') | pkg/fasta/lib/src/source/diet_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698