| 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.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, MemberKind, optional; | 10 import '../parser/parser.dart' show FormalParameterType, MemberKind, optional; |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 debugEvent("LiteralNull"); | 1348 debugEvent("LiteralNull"); |
| 1349 push(new KernelNullLiteral()..fileOffset = offsetForToken(token)); | 1349 push(new KernelNullLiteral()..fileOffset = offsetForToken(token)); |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 @override | 1352 @override |
| 1353 void handleLiteralMap( | 1353 void handleLiteralMap( |
| 1354 int count, Token beginToken, Token constKeyword, Token endToken) { | 1354 int count, Token beginToken, Token constKeyword, Token endToken) { |
| 1355 debugEvent("LiteralMap"); | 1355 debugEvent("LiteralMap"); |
| 1356 List<MapEntry> entries = popList(count) ?? <MapEntry>[]; | 1356 List<MapEntry> entries = popList(count) ?? <MapEntry>[]; |
| 1357 List<DartType> typeArguments = pop(); | 1357 List<DartType> typeArguments = pop(); |
| 1358 DartType keyType = const DynamicType(); | 1358 DartType keyType; |
| 1359 DartType valueType = const DynamicType(); | 1359 DartType valueType; |
| 1360 if (typeArguments != null) { | 1360 if (typeArguments != null) { |
| 1361 if (typeArguments.length != 2) { | 1361 if (typeArguments.length != 2) { |
| 1362 keyType = const DynamicType(); | 1362 keyType = null; |
| 1363 valueType = const DynamicType(); | 1363 valueType = null; |
| 1364 warningNotError( | 1364 warningNotError( |
| 1365 "Map literal requires two type arguments.", beginToken.charOffset); | 1365 "Map literal requires two type arguments.", beginToken.charOffset); |
| 1366 } else { | 1366 } else { |
| 1367 keyType = typeArguments[0]; | 1367 keyType = typeArguments[0]; |
| 1368 valueType = typeArguments[1]; | 1368 valueType = typeArguments[1]; |
| 1369 } | 1369 } |
| 1370 } | 1370 } |
| 1371 push(new KernelMapLiteral(entries, | 1371 push(new KernelMapLiteral(entries, |
| 1372 keyType: keyType, valueType: valueType, isConst: constKeyword != null) | 1372 keyType: keyType, valueType: valueType, isConst: constKeyword != null) |
| 1373 ..fileOffset = constKeyword?.charOffset ?? offsetForToken(beginToken)); | 1373 ..fileOffset = constKeyword?.charOffset ?? offsetForToken(beginToken)); |
| (...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3197 if (starToken == null) { | 3197 if (starToken == null) { |
| 3198 return AsyncMarker.Async; | 3198 return AsyncMarker.Async; |
| 3199 } else { | 3199 } else { |
| 3200 assert(identical(starToken.stringValue, "*")); | 3200 assert(identical(starToken.stringValue, "*")); |
| 3201 return AsyncMarker.AsyncStar; | 3201 return AsyncMarker.AsyncStar; |
| 3202 } | 3202 } |
| 3203 } else { | 3203 } else { |
| 3204 return internalError("Unknown async modifier: $asyncToken"); | 3204 return internalError("Unknown async modifier: $asyncToken"); |
| 3205 } | 3205 } |
| 3206 } | 3206 } |
| OLD | NEW |