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

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

Issue 2989073002: [fasta] Issue error for large integer literals (Closed)
Patch Set: 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.body_builder; 5 library fasta.body_builder;
6 6
7 import 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 hide InvalidExpression, InvalidInitializer, InvalidStatement; 8 hide InvalidExpression, InvalidInitializer, InvalidStatement;
9 9
10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; 10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 expressions.add(part); 1266 expressions.add(part);
1267 } 1267 }
1268 } 1268 }
1269 } 1269 }
1270 push(new KernelStringConcatenation(expressions ?? parts)); 1270 push(new KernelStringConcatenation(expressions ?? parts));
1271 } 1271 }
1272 1272
1273 @override 1273 @override
1274 void handleLiteralInt(Token token) { 1274 void handleLiteralInt(Token token) {
1275 debugEvent("LiteralInt"); 1275 debugEvent("LiteralInt");
1276 push(new KernelIntLiteral(int.parse(token.lexeme)) 1276 try {
1277 ..fileOffset = offsetForToken(token)); 1277 push(new KernelIntLiteral(int.parse(token.lexeme))
1278 ..fileOffset = offsetForToken(token));
1279 } on FormatException {
ahe 2017/08/01 11:34:13 Could you use onError error instead?
alexmarkov 2017/08/01 20:14:44 Done.
1280 push(buildCompileTimeError(
1281 fasta.templateIntegerLiteralIsOutOfRange.withArguments(token),
1282 token.charOffset));
1283 }
1278 } 1284 }
1279 1285
1280 @override 1286 @override
1281 void handleEmptyFunctionBody(Token semicolon) { 1287 void handleEmptyFunctionBody(Token semicolon) {
1282 debugEvent("ExpressionFunctionBody"); 1288 debugEvent("ExpressionFunctionBody");
1283 endBlockFunctionBody(0, null, semicolon); 1289 endBlockFunctionBody(0, null, semicolon);
1284 } 1290 }
1285 1291
1286 @override 1292 @override
1287 void handleExpressionFunctionBody(Token arrowToken, Token endToken) { 1293 void handleExpressionFunctionBody(Token arrowToken, Token endToken) {
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 return AsyncMarker.Async; 3806 return AsyncMarker.Async;
3801 } else { 3807 } else {
3802 assert(identical(starToken.stringValue, "*")); 3808 assert(identical(starToken.stringValue, "*"));
3803 return AsyncMarker.AsyncStar; 3809 return AsyncMarker.AsyncStar;
3804 } 3810 }
3805 } else { 3811 } else {
3806 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", 3812 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens",
3807 asyncToken.charOffset, null); 3813 asyncToken.charOffset, null);
3808 } 3814 }
3809 } 3815 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698