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

Side by Side Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 3001993002: improve fasta export directive recovery (Closed)
Patch Set: rebase and cleanup Created 3 years, 4 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.analyzer.ast_builder; 5 library fasta.analyzer.ast_builder;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory;
9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 switch (code.analyzerCode) { 1889 switch (code.analyzerCode) {
1890 case "EXPECTED_TYPE_NAME": 1890 case "EXPECTED_TYPE_NAME":
1891 errorReporter?.reportErrorForOffset( 1891 errorReporter?.reportErrorForOffset(
1892 ParserErrorCode.EXPECTED_TYPE_NAME, charOffset, 1); 1892 ParserErrorCode.EXPECTED_TYPE_NAME, charOffset, 1);
1893 return; 1893 return;
1894 case "EXPECTED_STRING_LITERAL": 1894 case "EXPECTED_STRING_LITERAL":
1895 errorReporter?.reportErrorForOffset( 1895 errorReporter?.reportErrorForOffset(
1896 ParserErrorCode.EXPECTED_STRING_LITERAL, charOffset, 1); 1896 ParserErrorCode.EXPECTED_STRING_LITERAL, charOffset, 1);
1897 return; 1897 return;
1898 case "UNEXPECTED_TOKEN": 1898 case "UNEXPECTED_TOKEN":
1899 var text = arguments['string']; 1899 String text = arguments['string'];
1900 if (text == null) { 1900 if (text == null) {
1901 Token token = arguments['token']; 1901 Token token = arguments['token'];
1902 if (token != null) { 1902 if (token != null) {
1903 text = token.lexeme; 1903 text = token.lexeme;
1904 } 1904 }
1905 } 1905 }
1906 errorReporter?.reportErrorForOffset( 1906 if (text == ';') {
1907 ParserErrorCode.UNEXPECTED_TOKEN, charOffset, 1, [text]); 1907 errorReporter?.reportErrorForOffset(
1908 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]);
1909 } else {
1910 errorReporter?.reportErrorForOffset(
1911 ParserErrorCode.UNEXPECTED_TOKEN, charOffset, 1, [text]);
1912 }
1908 return; 1913 return;
1909 default: 1914 default:
1910 // fall through 1915 // fall through
1911 } 1916 }
1912 library.addCompileTimeError(message, charOffset, uri); 1917 library.addCompileTimeError(message, charOffset, uri);
1913 } 1918 }
1914 } 1919 }
1915 1920
1916 /// Data structure placed on the stack to represent a class body. 1921 /// Data structure placed on the stack to represent a class body.
1917 /// 1922 ///
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 } else if (identical('var', s)) { 2016 } else if (identical('var', s)) {
2012 finalConstOrVarKeyword = token; 2017 finalConstOrVarKeyword = token;
2013 } else if (identical('covariant', s)) { 2018 } else if (identical('covariant', s)) {
2014 covariantKeyword = token; 2019 covariantKeyword = token;
2015 } else { 2020 } else {
2016 unhandled("$s", "modifier", token.charOffset, null); 2021 unhandled("$s", "modifier", token.charOffset, null);
2017 } 2022 }
2018 } 2023 }
2019 } 2024 }
2020 } 2025 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698