OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.parser.element_listener; | 5 library dart2js.parser.element_listener; |
6 | 6 |
7 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage; | 7 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage; |
8 | 8 |
9 import 'package:front_end/src/fasta/fasta_codes.dart' as codes; | 9 import 'package:front_end/src/fasta/fasta_codes.dart' as codes; |
10 | 10 |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 errorCode = MessageKind.UNTERMINATED_STRING; | 699 errorCode = MessageKind.UNTERMINATED_STRING; |
700 arguments = {"quote": arguments["string"]}; | 700 arguments = {"quote": arguments["string"]}; |
701 break; | 701 break; |
702 | 702 |
703 case "UNTERMINATED_TOKEN": | 703 case "UNTERMINATED_TOKEN": |
704 errorCode = MessageKind.UNTERMINATED_TOKEN; | 704 errorCode = MessageKind.UNTERMINATED_TOKEN; |
705 break; | 705 break; |
706 | 706 |
707 case "FASTA_IGNORED": | 707 case "FASTA_IGNORED": |
708 return null; // Ignored. This error is already implemented elsewhere. | 708 return null; // Ignored. This error is already implemented elsewhere. |
| 709 |
| 710 default: |
| 711 throw "Unexpected message code: ${message.code}"; |
709 } | 712 } |
710 SourceSpan span = reporter.spanFromToken(token); | 713 SourceSpan span = reporter.spanFromToken(token); |
711 reportError(span, errorCode, arguments); | 714 reportError(span, errorCode, arguments); |
712 return null; | 715 return null; |
713 } | 716 } |
714 | 717 |
715 /// Finds the preceding token via the begin token of the last AST node pushed | 718 /// Finds the preceding token via the begin token of the last AST node pushed |
716 /// on the [nodes] stack. | 719 /// on the [nodes] stack. |
717 Token findPrecedingToken(Token token) { | 720 Token findPrecedingToken(Token token) { |
718 Token result; | 721 Token result; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 memberErrors = memberErrors.tail.prepend(true); | 938 memberErrors = memberErrors.tail.prepend(true); |
936 } | 939 } |
937 reporter.reportErrorMessage(spannable, errorCode, arguments); | 940 reporter.reportErrorMessage(spannable, errorCode, arguments); |
938 } | 941 } |
939 | 942 |
940 void reportErrorFromToken(Token token, MessageKind errorCode, | 943 void reportErrorFromToken(Token token, MessageKind errorCode, |
941 [Map arguments = const {}]) { | 944 [Map arguments = const {}]) { |
942 reportError(reporter.spanFromToken(token), errorCode, arguments); | 945 reportError(reporter.spanFromToken(token), errorCode, arguments); |
943 } | 946 } |
944 } | 947 } |
OLD | NEW |