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

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

Issue 2738903002: Change the calling conventions for handleUnrecoverableError. (Closed)
Patch Set: Fix a code path I missed in element_listener.dart Created 3 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
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 '../parser/parser.dart' show FormalParameterType, optional; 7 import '../parser/parser.dart' show FormalParameterType, optional;
8 8
9 import '../parser/error_kind.dart' show ErrorKind; 9 import '../parser/error_kind.dart' show ErrorKind;
10 10
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 if (isDartLibrary && kind == ErrorKind.ExpectedFunctionBody) { 2192 if (isDartLibrary && kind == ErrorKind.ExpectedFunctionBody) {
2193 Token recover = skipNativeClause(token); 2193 Token recover = skipNativeClause(token);
2194 if (recover != null) return recover; 2194 if (recover != null) return recover;
2195 } else if (kind == ErrorKind.UnexpectedToken) { 2195 } else if (kind == ErrorKind.UnexpectedToken) {
2196 String expected = arguments["expected"]; 2196 String expected = arguments["expected"];
2197 const List<String> trailing = const <String>[")", "}", ";", ","]; 2197 const List<String> trailing = const <String>[")", "}", ";", ","];
2198 if (trailing.contains(token.stringValue) && trailing.contains(expected)) { 2198 if (trailing.contains(token.stringValue) && trailing.contains(expected)) {
2199 arguments.putIfAbsent("actual", () => token.value); 2199 arguments.putIfAbsent("actual", () => token.value);
2200 handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments); 2200 handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments);
2201 } 2201 }
2202 return token; 2202 return newSyntheticToken(token);
2203 } 2203 }
2204 return super.handleUnrecoverableError(token, kind, arguments); 2204 return super.handleUnrecoverableError(token, kind, arguments);
2205 } 2205 }
2206 2206
2207 @override 2207 @override
2208 Expression buildCompileTimeError(error, [int charOffset = -1]) { 2208 Expression buildCompileTimeError(error, [int charOffset = -1]) {
2209 String message = printUnexpected(uri, charOffset, error); 2209 String message = printUnexpected(uri, charOffset, error);
2210 Builder constructor = library.loader.getCompileTimeError(); 2210 Builder constructor = library.loader.getCompileTimeError();
2211 return new Throw(buildStaticInvocation(constructor.target, 2211 return new Throw(buildStaticInvocation(constructor.target,
2212 new Arguments(<Expression>[new StringLiteral(message)]), 2212 new Arguments(<Expression>[new StringLiteral(message)]),
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 } else if (node is TypeDeclarationBuilder) { 2692 } else if (node is TypeDeclarationBuilder) {
2693 return node.name; 2693 return node.name;
2694 } else if (node is PrefixBuilder) { 2694 } else if (node is PrefixBuilder) {
2695 return node.name; 2695 return node.name;
2696 } else if (node is ThisPropertyAccessor) { 2696 } else if (node is ThisPropertyAccessor) {
2697 return node.name.name; 2697 return node.name.name;
2698 } else { 2698 } else {
2699 return internalError("Unhandled: ${node.runtimeType}"); 2699 return internalError("Unhandled: ${node.runtimeType}");
2700 } 2700 }
2701 } 2701 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/element_listener.dart ('k') | pkg/front_end/lib/src/fasta/parser/dart_vm_native.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698