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