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

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

Issue 2723883002: Add AstBuilder support for fields. (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' 7 import 'package:front_end/src/fasta/parser/parser.dart'
8 show FormalParameterType, optional; 8 show FormalParameterType, optional;
9 9
10 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind; 10 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 @override 288 @override
289 void endTopLevelFields(int count, Token beginToken, Token endToken) { 289 void endTopLevelFields(int count, Token beginToken, Token endToken) {
290 debugEvent("TopLevelFields"); 290 debugEvent("TopLevelFields");
291 doFields(count); 291 doFields(count);
292 // There's no metadata here because of a slight assymetry between 292 // There's no metadata here because of a slight assymetry between
293 // [parseTopLevelMember] and [parseMember]. This assymetry leads to 293 // [parseTopLevelMember] and [parseMember]. This assymetry leads to
294 // DietListener discarding top-level member metadata. 294 // DietListener discarding top-level member metadata.
295 } 295 }
296 296
297 @override 297 @override
298 void endFields(int count, Token beginToken, Token endToken) { 298 void endFields(
299 int count, Token covariantKeyword, Token beginToken, Token endToken) {
299 debugEvent("Fields"); 300 debugEvent("Fields");
300 doFields(count); 301 doFields(count);
301 pop(); // Metadata. 302 pop(); // Metadata.
302 } 303 }
303 304
304 void doFields(int count) { 305 void doFields(int count) {
305 for (int i = 0; i < count; i++) { 306 for (int i = 0; i < count; i++) {
306 Expression initializer = pop(); 307 Expression initializer = pop();
307 Identifier identifier = pop(); 308 Identifier identifier = pop();
308 if (initializer != null) { 309 if (initializer != null) {
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 } else if (node is TypeDeclarationBuilder) { 2673 } else if (node is TypeDeclarationBuilder) {
2673 return node.name; 2674 return node.name;
2674 } else if (node is PrefixBuilder) { 2675 } else if (node is PrefixBuilder) {
2675 return node.name; 2676 return node.name;
2676 } else if (node is ThisPropertyAccessor) { 2677 } else if (node is ThisPropertyAccessor) {
2677 return node.name.name; 2678 return node.name.name;
2678 } else { 2679 } else {
2679 return internalError("Unhandled: ${node.runtimeType}"); 2680 return internalError("Unhandled: ${node.runtimeType}");
2680 } 2681 }
2681 } 2682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698