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

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

Issue 2716043003: Support for the 'covariant' keyword for formal parameters. (Closed)
Patch Set: Created 3 years, 9 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:front_end/src/fasta/parser/parser.dart' show 7 import 'package:front_end/src/fasta/parser/parser.dart' show
8 FormalParameterType, 8 FormalParameterType,
9 optional; 9 optional;
10 10
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 } 1270 }
1271 1271
1272 @override 1272 @override
1273 void endThrowExpression(Token throwToken, Token endToken) { 1273 void endThrowExpression(Token throwToken, Token endToken) {
1274 debugEvent("ThrowExpression"); 1274 debugEvent("ThrowExpression");
1275 Expression expression = popForValue(); 1275 Expression expression = popForValue();
1276 push(new Throw(expression)); 1276 push(new Throw(expression));
1277 } 1277 }
1278 1278
1279 @override 1279 @override
1280 void endFormalParameter(Token thisKeyword, FormalParameterType kind) { 1280 void endFormalParameter(Token covariantKeyword, Token thisKeyword,
1281 FormalParameterType kind) {
1281 debugEvent("FormalParameter"); 1282 debugEvent("FormalParameter");
1282 // TODO(ahe): Need beginToken here. 1283 // TODO(ahe): Need beginToken here.
1283 int charOffset = thisKeyword?.charOffset; 1284 int charOffset = thisKeyword?.charOffset;
1284 if (thisKeyword != null) { 1285 if (thisKeyword != null) {
1285 if (!inConstructor) { 1286 if (!inConstructor) {
1286 addCompileTimeError(thisKeyword.charOffset, 1287 addCompileTimeError(thisKeyword.charOffset,
1287 "'this' parameters can only be used on constructors."); 1288 "'this' parameters can only be used on constructors.");
1288 thisKeyword = null; 1289 thisKeyword = null;
1289 } 1290 }
1290 } 1291 }
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 } else if (node is TypeDeclarationBuilder) { 2704 } else if (node is TypeDeclarationBuilder) {
2704 return node.name; 2705 return node.name;
2705 } else if (node is PrefixBuilder) { 2706 } else if (node is PrefixBuilder) {
2706 return node.name; 2707 return node.name;
2707 } else if (node is ThisPropertyAccessor) { 2708 } else if (node is ThisPropertyAccessor) {
2708 return node.name.name; 2709 return node.name.name;
2709 } else { 2710 } else {
2710 return internalError("Unhandled: ${node.runtimeType}"); 2711 return internalError("Unhandled: ${node.runtimeType}");
2711 } 2712 }
2712 } 2713 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698