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.outline_builder; | 5 library fasta.outline_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' show ProcedureKind; | 7 import 'package:kernel/ast.dart' show ProcedureKind; |
8 | 8 |
9 import '../../scanner/token.dart' show Token; | 9 import '../../scanner/token.dart' show Token; |
10 | 10 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 MethodBody kind = pop(); | 321 MethodBody kind = pop(); |
322 List<FormalParameterBuilder> formals = pop(); | 322 List<FormalParameterBuilder> formals = pop(); |
323 int formalsOffset = pop(); | 323 int formalsOffset = pop(); |
324 List<TypeVariableBuilder> typeVariables = pop(); | 324 List<TypeVariableBuilder> typeVariables = pop(); |
325 int charOffset = pop(); | 325 int charOffset = pop(); |
326 String name = pop(); | 326 String name = pop(); |
327 TypeBuilder returnType = pop(); | 327 TypeBuilder returnType = pop(); |
328 int modifiers = | 328 int modifiers = |
329 Modifier.validate(pop(), isAbstract: kind == MethodBody.Abstract); | 329 Modifier.validate(pop(), isAbstract: kind == MethodBody.Abstract); |
330 List<MetadataBuilder> metadata = pop(); | 330 List<MetadataBuilder> metadata = pop(); |
| 331 String documentationComment = _getDocumentationComment(beginToken); |
331 checkEmpty(beginToken.charOffset); | 332 checkEmpty(beginToken.charOffset); |
332 library.addProcedure( | 333 library.addProcedure( |
| 334 documentationComment, |
333 metadata, | 335 metadata, |
334 modifiers, | 336 modifiers, |
335 returnType, | 337 returnType, |
336 name, | 338 name, |
337 typeVariables, | 339 typeVariables, |
338 formals, | 340 formals, |
339 computeProcedureKind(getOrSet), | 341 computeProcedureKind(getOrSet), |
340 charOffset, | 342 charOffset, |
341 formalsOffset, | 343 formalsOffset, |
342 endToken.charOffset, | 344 endToken.charOffset, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 name = nameOrOperator; | 424 name = nameOrOperator; |
423 kind = computeProcedureKind(getOrSet); | 425 kind = computeProcedureKind(getOrSet); |
424 } | 426 } |
425 TypeBuilder returnType = pop(); | 427 TypeBuilder returnType = pop(); |
426 int modifiers = | 428 int modifiers = |
427 Modifier.validate(pop(), isAbstract: bodyKind == MethodBody.Abstract); | 429 Modifier.validate(pop(), isAbstract: bodyKind == MethodBody.Abstract); |
428 if ((modifiers & externalMask) != 0) { | 430 if ((modifiers & externalMask) != 0) { |
429 modifiers &= ~abstractMask; | 431 modifiers &= ~abstractMask; |
430 } | 432 } |
431 List<MetadataBuilder> metadata = pop(); | 433 List<MetadataBuilder> metadata = pop(); |
| 434 String documentationComment = _getDocumentationComment(beginToken); |
432 library.addProcedure( | 435 library.addProcedure( |
| 436 documentationComment, |
433 metadata, | 437 metadata, |
434 modifiers, | 438 modifiers, |
435 returnType, | 439 returnType, |
436 name, | 440 name, |
437 typeVariables, | 441 typeVariables, |
438 formals, | 442 formals, |
439 kind, | 443 kind, |
440 charOffset, | 444 charOffset, |
441 formalsOffset, | 445 formalsOffset, |
442 endToken.charOffset, | 446 endToken.charOffset, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 silenceParserErrors = true; | 719 silenceParserErrors = true; |
716 } | 720 } |
717 | 721 |
718 @override | 722 @override |
719 void endTopLevelFields(int count, Token beginToken, Token endToken) { | 723 void endTopLevelFields(int count, Token beginToken, Token endToken) { |
720 debugEvent("endTopLevelFields"); | 724 debugEvent("endTopLevelFields"); |
721 List fieldsInfo = popList(count * 4); | 725 List fieldsInfo = popList(count * 4); |
722 TypeBuilder type = pop(); | 726 TypeBuilder type = pop(); |
723 int modifiers = Modifier.validate(pop()); | 727 int modifiers = Modifier.validate(pop()); |
724 List<MetadataBuilder> metadata = pop(); | 728 List<MetadataBuilder> metadata = pop(); |
725 library.addFields(metadata, modifiers, type, fieldsInfo); | 729 String documentationComment = _getDocumentationComment(beginToken); |
| 730 library.addFields( |
| 731 documentationComment, metadata, modifiers, type, fieldsInfo); |
726 checkEmpty(beginToken.charOffset); | 732 checkEmpty(beginToken.charOffset); |
727 } | 733 } |
728 | 734 |
729 @override | 735 @override |
730 void endFields(int count, Token beginToken, Token endToken) { | 736 void endFields(int count, Token beginToken, Token endToken) { |
731 debugEvent("Fields"); | 737 debugEvent("Fields"); |
732 List fieldsInfo = popList(count * 4); | 738 List fieldsInfo = popList(count * 4); |
733 TypeBuilder type = pop(); | 739 TypeBuilder type = pop(); |
734 int modifiers = Modifier.validate(pop()); | 740 int modifiers = Modifier.validate(pop()); |
735 List<MetadataBuilder> metadata = pop(); | 741 List<MetadataBuilder> metadata = pop(); |
736 library.addFields(metadata, modifiers, type, fieldsInfo); | 742 String documentationComment = _getDocumentationComment(beginToken); |
| 743 library.addFields( |
| 744 documentationComment, metadata, modifiers, type, fieldsInfo); |
737 } | 745 } |
738 | 746 |
739 @override | 747 @override |
740 void endTypeVariable(Token token, Token extendsOrSuper) { | 748 void endTypeVariable(Token token, Token extendsOrSuper) { |
741 debugEvent("endTypeVariable"); | 749 debugEvent("endTypeVariable"); |
742 TypeBuilder bound = pop(); | 750 TypeBuilder bound = pop(); |
743 int charOffset = pop(); | 751 int charOffset = pop(); |
744 String name = pop(); | 752 String name = pop(); |
745 // TODO(paulberry): type variable metadata should not be ignored. See | 753 // TODO(paulberry): type variable metadata should not be ignored. See |
746 // dartbug.com/28981. | 754 // dartbug.com/28981. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 MethodBody kind = pop(); | 794 MethodBody kind = pop(); |
787 ConstructorReferenceBuilder redirectionTarget; | 795 ConstructorReferenceBuilder redirectionTarget; |
788 if (kind == MethodBody.RedirectingFactoryBody) { | 796 if (kind == MethodBody.RedirectingFactoryBody) { |
789 redirectionTarget = pop(); | 797 redirectionTarget = pop(); |
790 } | 798 } |
791 List<FormalParameterBuilder> formals = pop(); | 799 List<FormalParameterBuilder> formals = pop(); |
792 int formalsOffset = pop(); | 800 int formalsOffset = pop(); |
793 var name = pop(); | 801 var name = pop(); |
794 int modifiers = Modifier.validate(pop()); | 802 int modifiers = Modifier.validate(pop()); |
795 List<MetadataBuilder> metadata = pop(); | 803 List<MetadataBuilder> metadata = pop(); |
| 804 String documentationComment = _getDocumentationComment(beginToken); |
796 library.addFactoryMethod( | 805 library.addFactoryMethod( |
| 806 documentationComment, |
797 metadata, | 807 metadata, |
798 modifiers, | 808 modifiers, |
799 name, | 809 name, |
800 formals, | 810 formals, |
801 redirectionTarget, | 811 redirectionTarget, |
802 factoryKeyword.next.charOffset, | 812 factoryKeyword.next.charOffset, |
803 formalsOffset, | 813 formalsOffset, |
804 endToken.charOffset, | 814 endToken.charOffset, |
805 nativeMethodName); | 815 nativeMethodName); |
806 nativeMethodName = null; | 816 nativeMethodName = null; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 docToken = docToken.next; | 947 docToken = docToken.next; |
938 } | 948 } |
939 return buffer.toString(); | 949 return buffer.toString(); |
940 } | 950 } |
941 | 951 |
942 @override | 952 @override |
943 void debugEvent(String name) { | 953 void debugEvent(String name) { |
944 // printEvent(name); | 954 // printEvent(name); |
945 } | 955 } |
946 } | 956 } |
OLD | NEW |