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 '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 Loading... |
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 Loading... |
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 } |
OLD | NEW |