Chromium Code Reviews| 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.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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 whileKeyword, | 1219 whileKeyword, |
| 1220 condition.leftParenthesis, | 1220 condition.leftParenthesis, |
| 1221 condition.expression, | 1221 condition.expression, |
| 1222 condition.rightParenthesis, | 1222 condition.rightParenthesis, |
| 1223 semicolon)); | 1223 semicolon)); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void endConditionalUri(Token ifKeyword, Token equalitySign) { | 1226 void endConditionalUri(Token ifKeyword, Token equalitySign) { |
| 1227 debugEvent("ConditionalUri"); | 1227 debugEvent("ConditionalUri"); |
| 1228 StringLiteral libraryUri = pop(); | 1228 StringLiteral libraryUri = pop(); |
| 1229 // TODO(paulberry,ahe): the parser should report the right paren token to | |
| 1230 // the listener. | |
| 1231 Token rightParen = null; | |
| 1232 StringLiteral value; | 1229 StringLiteral value; |
| 1233 if (equalitySign != null) { | 1230 if (equalitySign != null) { |
| 1234 value = pop(); | 1231 value = pop(); |
| 1235 } | 1232 } |
| 1236 DottedName name = pop(); | 1233 DottedName name = pop(); |
| 1237 // TODO(paulberry,ahe): what if there is no `(` token due to an error in the | 1234 // TODO(paulberry,ahe): what if there is no `(` token due to an error in the |
| 1238 // file being parsed? It seems like we need the parser to do adequate error | 1235 // file being parsed? It seems like we need the parser to do adequate error |
| 1239 // recovery and then report both the ifKeyword and leftParen tokens to the | 1236 // recovery and then report both the ifKeyword and leftParen tokens to the |
| 1240 // listener. | 1237 // listener. |
| 1241 Token leftParen = ifKeyword.next; | 1238 Token leftParen = ifKeyword.next; |
| 1239 // TODO(paulberry,ahe): the parser should report the right paren token to | |
| 1240 // the listener. | |
|
danrubel
2017/08/30 17:44:03
Is this comment still valid? Are there situations
Brian Wilkerson
2017/08/30 18:03:49
I think so...
If the paren is missing, or if ther
| |
| 1241 Token rightParen = name.endToken.next; | |
| 1242 push(ast.configuration(ifKeyword, leftParen, name, equalitySign, value, | 1242 push(ast.configuration(ifKeyword, leftParen, name, equalitySign, value, |
| 1243 rightParen, libraryUri)); | 1243 rightParen, libraryUri)); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 @override | 1246 @override |
| 1247 void endConditionalUris(int count) { | 1247 void endConditionalUris(int count) { |
| 1248 debugEvent("ConditionalUris"); | 1248 debugEvent("ConditionalUris"); |
| 1249 push(popList(count) ?? NullValue.ConditionalUris); | 1249 push(popList(count) ?? NullValue.ConditionalUris); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2055 } else if (identical('var', s)) { | 2055 } else if (identical('var', s)) { |
| 2056 finalConstOrVarKeyword = token; | 2056 finalConstOrVarKeyword = token; |
| 2057 } else if (identical('covariant', s)) { | 2057 } else if (identical('covariant', s)) { |
| 2058 covariantKeyword = token; | 2058 covariantKeyword = token; |
| 2059 } else { | 2059 } else { |
| 2060 unhandled("$s", "modifier", token.charOffset, null); | 2060 unhandled("$s", "modifier", token.charOffset, null); |
| 2061 } | 2061 } |
| 2062 } | 2062 } |
| 2063 } | 2063 } |
| 2064 } | 2064 } |
| OLD | NEW |