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 Message; | 7 import 'package:front_end/src/fasta/fasta_codes.dart' show Message; |
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 pushNode(null); | 537 pushNode(null); |
538 } | 538 } |
539 | 539 |
540 Token handleError(Token token, Message message) { | 540 Token handleError(Token token, Message message) { |
541 MessageKind errorCode; | 541 MessageKind errorCode; |
542 Map<String, dynamic> arguments = message.arguments; | 542 Map<String, dynamic> arguments = message.arguments; |
543 | 543 |
544 switch (message.code.dart2jsCode) { | 544 switch (message.code.dart2jsCode) { |
545 case "MISSING_TOKEN_BEFORE_THIS": | 545 case "MISSING_TOKEN_BEFORE_THIS": |
546 String expected = arguments["string"]; | 546 String expected = arguments["string"]; |
547 // TODO(danrubel) This functionality is being replaced by | |
ahe
2017/08/22 12:27:00
Add colon after "(danrubel)".
danrubel
2017/08/25 15:30:18
Fixed in https://codereview.chromium.org/300326300
| |
548 // the parser's ensureSemicolon method. | |
547 if (identical(";", expected)) { | 549 if (identical(";", expected)) { |
548 // When a semicolon is missing, it often leads to an error on the | 550 // When a semicolon is missing, it often leads to an error on the |
549 // following line. So we try to find the token preceding the semicolon | 551 // following line. So we try to find the token preceding the semicolon |
550 // and report that something is missing *after* it. | 552 // and report that something is missing *after* it. |
551 Token preceding = findPrecedingToken(token); | 553 Token preceding = findPrecedingToken(token); |
552 if (preceding == token) { | 554 if (preceding == token) { |
553 reportErrorFromToken(token, MessageKind.MISSING_TOKEN_BEFORE_THIS, | 555 reportErrorFromToken(token, MessageKind.MISSING_TOKEN_BEFORE_THIS, |
554 {'token': expected}); | 556 {'token': expected}); |
555 } else { | 557 } else { |
556 reportErrorFromToken(preceding, | 558 reportErrorFromToken(preceding, |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
943 memberErrors = memberErrors.tail.prepend(true); | 945 memberErrors = memberErrors.tail.prepend(true); |
944 } | 946 } |
945 reporter.reportErrorMessage(spannable, errorCode, arguments); | 947 reporter.reportErrorMessage(spannable, errorCode, arguments); |
946 } | 948 } |
947 | 949 |
948 void reportErrorFromToken(Token token, MessageKind errorCode, | 950 void reportErrorFromToken(Token token, MessageKind errorCode, |
949 [Map arguments = const {}]) { | 951 [Map arguments = const {}]) { |
950 reportError(reporter.spanFromToken(token), errorCode, arguments); | 952 reportError(reporter.spanFromToken(token), errorCode, arguments); |
951 } | 953 } |
952 } | 954 } |
OLD | NEW |