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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2856363002: Inference for typed ListLiteral(s). (Closed)
Patch Set: Created 3 years, 7 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/front_end/lib/src/fasta/kernel/kernel_ast_factory.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.body_builder; 5 library fasta.body_builder;
6 6
7 import '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; 8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody;
9 9
10 import '../parser/parser.dart' show FormalParameterType, optional; 10 import '../parser/parser.dart' show FormalParameterType, optional;
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 List<DartType> typeArguments = pop(); 1285 List<DartType> typeArguments = pop();
1286 DartType typeArgument = const DynamicType(); 1286 DartType typeArgument = const DynamicType();
1287 if (typeArguments != null) { 1287 if (typeArguments != null) {
1288 typeArgument = typeArguments.first; 1288 typeArgument = typeArguments.first;
1289 if (typeArguments.length > 1) { 1289 if (typeArguments.length > 1) {
1290 typeArgument = const DynamicType(); 1290 typeArgument = const DynamicType();
1291 warningNotError( 1291 warningNotError(
1292 "Too many type arguments on List literal.", beginToken.charOffset); 1292 "Too many type arguments on List literal.", beginToken.charOffset);
1293 } 1293 }
1294 } 1294 }
1295 push(new ListLiteral(expressions, 1295 push(astFactory.listLiteral(expressions, typeArgument, constKeyword != null,
1296 typeArgument: typeArgument, isConst: constKeyword != null) 1296 constKeyword ?? beginToken));
1297 ..fileOffset = constKeyword?.charOffset ?? beginToken.charOffset);
1298 } 1297 }
1299 1298
1300 @override 1299 @override
1301 void handleLiteralBool(Token token) { 1300 void handleLiteralBool(Token token) {
1302 debugEvent("LiteralBool"); 1301 debugEvent("LiteralBool");
1303 bool value = optional("true", token); 1302 bool value = optional("true", token);
1304 assert(value || optional("false", token)); 1303 assert(value || optional("false", token));
1305 push(astFactory.boolLiteral(value, token)); 1304 push(astFactory.boolLiteral(value, token));
1306 } 1305 }
1307 1306
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 } else if (node is PrefixBuilder) { 3130 } else if (node is PrefixBuilder) {
3132 return node.name; 3131 return node.name;
3133 } else if (node is ThisAccessor) { 3132 } else if (node is ThisAccessor) {
3134 return node.isSuper ? "super" : "this"; 3133 return node.isSuper ? "super" : "this";
3135 } else if (node is FastaAccessor) { 3134 } else if (node is FastaAccessor) {
3136 return node.plainNameForRead; 3135 return node.plainNameForRead;
3137 } else { 3136 } else {
3138 return internalError("Unhandled: ${node.runtimeType}"); 3137 return internalError("Unhandled: ${node.runtimeType}");
3139 } 3138 }
3140 } 3139 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698