| 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 '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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 @override | 408 @override |
| 409 void endMetadataStar(int count, bool forParameter) { | 409 void endMetadataStar(int count, bool forParameter) { |
| 410 debugEvent("MetadataStar"); | 410 debugEvent("MetadataStar"); |
| 411 push(popList(count) ?? NullValue.Metadata); | 411 push(popList(count) ?? NullValue.Metadata); |
| 412 } | 412 } |
| 413 | 413 |
| 414 @override | 414 @override |
| 415 void endTopLevelFields(int count, Token beginToken, Token endToken) { | 415 void endTopLevelFields(int count, Token beginToken, Token endToken) { |
| 416 debugEvent("TopLevelFields"); | 416 debugEvent("TopLevelFields"); |
| 417 doFields(count); | 417 push(count); |
| 418 } | 418 } |
| 419 | 419 |
| 420 @override | 420 @override |
| 421 void endFields(int count, Token beginToken, Token endToken) { | 421 void endFields(int count, Token beginToken, Token endToken) { |
| 422 debugEvent("Fields"); | 422 debugEvent("Fields"); |
| 423 doFields(count); | 423 push(count); |
| 424 } | 424 } |
| 425 | 425 |
| 426 void doFields(int count) { | 426 @override |
| 427 void finishFields() { |
| 428 debugEvent("finishFields"); |
| 429 int count = pop(); |
| 427 List<FieldBuilder> fields = <FieldBuilder>[]; | 430 List<FieldBuilder> fields = <FieldBuilder>[]; |
| 428 for (int i = 0; i < count; i++) { | 431 for (int i = 0; i < count; i++) { |
| 429 Expression initializer = pop(); | 432 Expression initializer = pop(); |
| 430 Identifier identifier = pop(); | 433 Identifier identifier = pop(); |
| 431 String name = identifier.name; | 434 String name = identifier.name; |
| 432 FieldBuilder field; | 435 FieldBuilder field; |
| 433 if (classBuilder != null) { | 436 if (classBuilder != null) { |
| 434 field = classBuilder[name]; | 437 field = classBuilder[name]; |
| 435 } else { | 438 } else { |
| 436 field = library[name]; | 439 field = library[name]; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 463 for (Expression annotation in annotations) { | 466 for (Expression annotation in annotations) { |
| 464 field.addAnnotation(cloner.clone(annotation)); | 467 field.addAnnotation(cloner.clone(annotation)); |
| 465 } | 468 } |
| 466 } | 469 } |
| 467 } | 470 } |
| 468 } | 471 } |
| 469 | 472 |
| 470 @override | 473 @override |
| 471 void endMember() { | 474 void endMember() { |
| 472 debugEvent("Member"); | 475 debugEvent("Member"); |
| 473 checkEmpty(-1); | |
| 474 } | 476 } |
| 475 | 477 |
| 476 @override | 478 @override |
| 477 void endBlockFunctionBody(int count, Token beginToken, Token endToken) { | 479 void endBlockFunctionBody(int count, Token beginToken, Token endToken) { |
| 478 debugEvent("BlockFunctionBody"); | 480 debugEvent("BlockFunctionBody"); |
| 479 if (beginToken == null) { | 481 if (beginToken == null) { |
| 480 assert(count == 0); | 482 assert(count == 0); |
| 481 push(NullValue.Block); | 483 push(NullValue.Block); |
| 482 } else { | 484 } else { |
| 483 Block block = popBlock(count, beginToken); | 485 Block block = popBlock(count, beginToken); |
| (...skipping 3312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 return AsyncMarker.Async; | 3798 return AsyncMarker.Async; |
| 3797 } else { | 3799 } else { |
| 3798 assert(identical(starToken.stringValue, "*")); | 3800 assert(identical(starToken.stringValue, "*")); |
| 3799 return AsyncMarker.AsyncStar; | 3801 return AsyncMarker.AsyncStar; |
| 3800 } | 3802 } |
| 3801 } else { | 3803 } else { |
| 3802 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", | 3804 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", |
| 3803 asyncToken.charOffset, null); | 3805 asyncToken.charOffset, null); |
| 3804 } | 3806 } |
| 3805 } | 3807 } |
| OLD | NEW |