| 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 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 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) { | 2205 Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) { |
| 2206 if (isDartLibrary && kind == ErrorKind.ExpectedFunctionBody) { | 2206 if (isDartLibrary && kind == ErrorKind.ExpectedFunctionBody) { |
| 2207 Token recover = skipNativeClause(token); | 2207 Token recover = skipNativeClause(token); |
| 2208 if (recover != null) return recover; | 2208 if (recover != null) return recover; |
| 2209 } else if (kind == ErrorKind.UnexpectedToken) { | 2209 } else if (kind == ErrorKind.UnexpectedToken) { |
| 2210 String expected = arguments["expected"]; | 2210 String expected = arguments["expected"]; |
| 2211 const List<String> trailing = const <String>[")", "}", ";", ","]; | 2211 const List<String> trailing = const <String>[")", "}", ";", ","]; |
| 2212 if (trailing.contains(token.stringValue) && trailing.contains(expected)) { | 2212 if (trailing.contains(token.stringValue) && trailing.contains(expected)) { |
| 2213 arguments.putIfAbsent("actual", () => token.value); | 2213 arguments.putIfAbsent("actual", () => token.value); |
| 2214 handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments); | 2214 handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments); |
| 2215 return token; |
| 2215 } | 2216 } |
| 2216 return token; | |
| 2217 } | 2217 } |
| 2218 return super.handleUnrecoverableError(token, kind, arguments); | 2218 return super.handleUnrecoverableError(token, kind, arguments); |
| 2219 } | 2219 } |
| 2220 | 2220 |
| 2221 @override | 2221 @override |
| 2222 Expression buildCompileTimeError(error, [int charOffset = -1]) { | 2222 Expression buildCompileTimeError(error, [int charOffset = -1]) { |
| 2223 String message = printUnexpected(uri, charOffset, error); | 2223 String message = printUnexpected(uri, charOffset, error); |
| 2224 Builder constructor = library.loader.getCompileTimeError(); | 2224 Builder constructor = library.loader.getCompileTimeError(); |
| 2225 return new Throw(buildStaticInvocation(constructor.target, | 2225 return new Throw(buildStaticInvocation(constructor.target, |
| 2226 new Arguments(<Expression>[new StringLiteral(message)]), | 2226 new Arguments(<Expression>[new StringLiteral(message)]), |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 } else if (node is PrefixBuilder) { | 2711 } else if (node is PrefixBuilder) { |
| 2712 return node.name; | 2712 return node.name; |
| 2713 } else if (node is ThisAccessor) { | 2713 } else if (node is ThisAccessor) { |
| 2714 return node.isSuper ? "super" : "this"; | 2714 return node.isSuper ? "super" : "this"; |
| 2715 } else if (node is BuilderAccessor) { | 2715 } else if (node is BuilderAccessor) { |
| 2716 return node.plainNameForRead; | 2716 return node.plainNameForRead; |
| 2717 } else { | 2717 } else { |
| 2718 return internalError("Unhandled: ${node.runtimeType}"); | 2718 return internalError("Unhandled: ${node.runtimeType}"); |
| 2719 } | 2719 } |
| 2720 } | 2720 } |
| OLD | NEW |