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

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

Issue 3005973002: Fix and triage more tests (Closed)
Patch Set: Created 3 years, 3 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 String lexeme = token.lexeme; 1074 String lexeme = token.lexeme;
1075 if (identical('async', lexeme) || identical('yield', lexeme)) { 1075 if (identical('async', lexeme) || identical('yield', lexeme)) {
1076 errorReporter?.reportErrorForOffset( 1076 errorReporter?.reportErrorForOffset(
1077 ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER, 1077 ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
1078 token.charOffset, 1078 token.charOffset,
1079 token.charCount); 1079 token.charCount);
1080 push(ast.simpleIdentifier(token)); 1080 push(ast.simpleIdentifier(token));
1081 return token; 1081 return token;
1082 } 1082 }
1083 } 1083 }
1084 return super.handleUnrecoverableError(token, message); 1084 // TODO(brianwilkerson) After we've mapped all of the Fasta messages to
1085 // analyzer messages, throw an error when we get to this point.
danrubel 2017/08/31 21:16:54 I prefer either throwing an error message or addin
Brian Wilkerson 2017/09/01 00:48:17 Ok, I've updated it to throw an exception, but I a
1085 } 1086 }
1086 1087
1087 void handleUnaryPrefixExpression(Token token) { 1088 void handleUnaryPrefixExpression(Token token) {
1088 debugEvent("UnaryPrefixExpression"); 1089 debugEvent("UnaryPrefixExpression");
1089 push(ast.prefixExpression(token, pop())); 1090 push(ast.prefixExpression(token, pop()));
1090 } 1091 }
1091 1092
1092 void handleUnaryPrefixAssignmentExpression(Token token) { 1093 void handleUnaryPrefixAssignmentExpression(Token token) {
1093 debugEvent("UnaryPrefixAssignmentExpression"); 1094 debugEvent("UnaryPrefixAssignmentExpression");
1094 push(ast.prefixExpression(token, pop())); 1095 push(ast.prefixExpression(token, pop()));
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 errorReporter?.reportErrorForOffset( 1950 errorReporter?.reportErrorForOffset(
1950 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]); 1951 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]);
1951 } else { 1952 } else {
1952 errorReporter?.reportErrorForOffset(ParserErrorCode.UNEXPECTED_TOKEN, 1953 errorReporter?.reportErrorForOffset(ParserErrorCode.UNEXPECTED_TOKEN,
1953 charOffset, text.length, [text]); 1954 charOffset, text.length, [text]);
1954 } 1955 }
1955 return; 1956 return;
1956 default: 1957 default:
1957 // fall through 1958 // fall through
1958 } 1959 }
1959 library.addCompileTimeError(message, charOffset, uri); 1960 // TODO(brianwilkerson) After we've mapped all of the Fasta messages to
1961 // analyzer messages, throw an error when we get to this point.
danrubel 2017/08/31 21:16:54 Ditto.
1960 } 1962 }
1961 1963
1962 /// A marker method used to mark locations where a token is being located in 1964 /// A marker method used to mark locations where a token is being located in
1963 /// an unsafe way. In all such cases the parser needs to be fixed to pass in 1965 /// an unsafe way. In all such cases the parser needs to be fixed to pass in
1964 /// the token. 1966 /// the token.
1965 Token unsafeToken(Token token, TokenType tokenType) { 1967 Token unsafeToken(Token token, TokenType tokenType) {
1966 // TODO(brianwilkerson) Eliminate the need for this method. 1968 // TODO(brianwilkerson) Eliminate the need for this method.
1967 return token.type == tokenType ? token : null; 1969 return token.type == tokenType ? token : null;
1968 } 1970 }
1969 } 1971 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 } else if (identical('var', s)) { 2068 } else if (identical('var', s)) {
2067 finalConstOrVarKeyword = token; 2069 finalConstOrVarKeyword = token;
2068 } else if (identical('covariant', s)) { 2070 } else if (identical('covariant', s)) {
2069 covariantKeyword = token; 2071 covariantKeyword = token;
2070 } else { 2072 } else {
2071 unhandled("$s", "modifier", token.charOffset, null); 2073 unhandled("$s", "modifier", token.charOffset, null);
2072 } 2074 }
2073 } 2075 }
2074 } 2076 }
2075 } 2077 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698