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

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

Issue 2899343002: Complain about function literals not being constant expressions. (Closed)
Patch Set: Created 3 years, 6 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 | tests/co19/co19-kernel.status » ('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, MemberKind, optional; 10 import '../parser/parser.dart' show FormalParameterType, MemberKind, optional;
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 Statement body = popStatement(); 2147 Statement body = popStatement();
2148 AsyncMarker asyncModifier = pop(); 2148 AsyncMarker asyncModifier = pop();
2149 exitLocalScope(); 2149 exitLocalScope();
2150 FormalParameters formals = pop(); 2150 FormalParameters formals = pop();
2151 exitFunction(); 2151 exitFunction();
2152 List<TypeParameter> typeParameters = pop(); 2152 List<TypeParameter> typeParameters = pop();
2153 FunctionNode function = formals.addToFunction(new FunctionNode(body, 2153 FunctionNode function = formals.addToFunction(new FunctionNode(body,
2154 typeParameters: typeParameters, asyncMarker: asyncModifier) 2154 typeParameters: typeParameters, asyncMarker: asyncModifier)
2155 ..fileOffset = beginToken.charOffset 2155 ..fileOffset = beginToken.charOffset
2156 ..fileEndOffset = token.charOffset); 2156 ..fileEndOffset = token.charOffset);
2157 push(astFactory.functionExpression(function, beginToken)); 2157 if (constantExpressionRequired) {
2158 push(buildCompileTimeError(
2159 "Not a constant expression.", formals.charOffset));
2160 } else {
2161 push(astFactory.functionExpression(function, beginToken));
2162 }
2158 } 2163 }
2159 2164
2160 @override 2165 @override
2161 void endDoWhileStatement( 2166 void endDoWhileStatement(
2162 Token doKeyword, Token whileKeyword, Token endToken) { 2167 Token doKeyword, Token whileKeyword, Token endToken) {
2163 debugEvent("DoWhileStatement"); 2168 debugEvent("DoWhileStatement");
2164 Expression condition = popForValue(); 2169 Expression condition = popForValue();
2165 Statement body = popStatement(); 2170 Statement body = popStatement();
2166 JumpTarget continueTarget = exitContinueTarget(); 2171 JumpTarget continueTarget = exitContinueTarget();
2167 JumpTarget breakTarget = exitBreakTarget(); 2172 JumpTarget breakTarget = exitBreakTarget();
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 if (starToken == null) { 3193 if (starToken == null) {
3189 return AsyncMarker.Async; 3194 return AsyncMarker.Async;
3190 } else { 3195 } else {
3191 assert(identical(starToken.stringValue, "*")); 3196 assert(identical(starToken.stringValue, "*"));
3192 return AsyncMarker.AsyncStar; 3197 return AsyncMarker.AsyncStar;
3193 } 3198 }
3194 } else { 3199 } else {
3195 return internalError("Unknown async modifier: $asyncToken"); 3200 return internalError("Unknown async modifier: $asyncToken");
3196 } 3201 }
3197 } 3202 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698