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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_ast.dart

Issue 1762193002: Resynthesize codeOffset/codeLength properties. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 serialization.summarize_ast; 5 library serialization.summarize_ast;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/src/generated/utilities_dart.dart'; 10 import 'package:analyzer/src/generated/utilities_dart.dart';
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 'Unexpected identifier type: ${identifier.runtimeType}'); 86 'Unexpected identifier type: ${identifier.runtimeType}');
87 } 87 }
88 return b; 88 return b;
89 } 89 }
90 90
91 @override 91 @override
92 EntityRefBuilder serializePropertyAccess(PropertyAccess access) { 92 EntityRefBuilder serializePropertyAccess(PropertyAccess access) {
93 Expression target = access.target; 93 Expression target = access.target;
94 if (target is Identifier) { 94 if (target is Identifier) {
95 EntityRefBuilder targetRef = serializeIdentifier(target); 95 EntityRefBuilder targetRef = serializeIdentifier(target);
96 return new EntityRefBuilder( 96 return new EntityRefBuilder(reference: visitor.serializeReference(
97 reference: visitor.serializeReference( 97 targetRef.reference, access.propertyName.name));
98 targetRef.reference, access.propertyName.name));
99 } else { 98 } else {
100 // TODO(scheglov) should we handle other targets in malformed constants? 99 // TODO(scheglov) should we handle other targets in malformed constants?
101 throw new StateError('Unexpected target type: ${target.runtimeType}'); 100 throw new StateError('Unexpected target type: ${target.runtimeType}');
102 } 101 }
103 } 102 }
104 103
105 @override 104 @override
106 EntityRefBuilder serializeType(TypeName node) { 105 EntityRefBuilder serializeType(TypeName node) {
107 return visitor.serializeTypeName(node); 106 return visitor.serializeTypeName(node);
108 } 107 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 serializer.serializeAnnotation(a); 341 serializer.serializeAnnotation(a);
343 return serializer.toBuilder(); 342 return serializer.toBuilder();
344 }).toList(); 343 }).toList();
345 } 344 }
346 345
347 /** 346 /**
348 * Serialize a [ClassDeclaration] or [ClassTypeAlias] into an [UnlinkedClass] 347 * Serialize a [ClassDeclaration] or [ClassTypeAlias] into an [UnlinkedClass]
349 * and store the result in [classes]. 348 * and store the result in [classes].
350 */ 349 */
351 void serializeClass( 350 void serializeClass(
351 AstNode node,
352 Token abstractKeyword, 352 Token abstractKeyword,
353 String name, 353 String name,
354 int nameOffset, 354 int nameOffset,
355 TypeParameterList typeParameters, 355 TypeParameterList typeParameters,
356 TypeName superclass, 356 TypeName superclass,
357 WithClause withClause, 357 WithClause withClause,
358 ImplementsClause implementsClause, 358 ImplementsClause implementsClause,
359 NodeList<ClassMember> members, 359 NodeList<ClassMember> members,
360 bool isMixinApplication, 360 bool isMixinApplication,
361 Comment documentationComment, 361 Comment documentationComment,
(...skipping 26 matching lines...) Expand all
388 for (ClassMember member in members) { 388 for (ClassMember member in members) {
389 member.accept(this); 389 member.accept(this);
390 } 390 }
391 scopes.removeLast(); 391 scopes.removeLast();
392 } 392 }
393 b.executables = executables; 393 b.executables = executables;
394 b.fields = variables; 394 b.fields = variables;
395 b.isAbstract = abstractKeyword != null; 395 b.isAbstract = abstractKeyword != null;
396 b.documentationComment = serializeDocumentation(documentationComment); 396 b.documentationComment = serializeDocumentation(documentationComment);
397 b.annotations = serializeAnnotations(annotations); 397 b.annotations = serializeAnnotations(annotations);
398 serializeCodeRange(b, node);
398 classes.add(b); 399 classes.add(b);
399 scopes.removeLast(); 400 scopes.removeLast();
400 assert(scopes.length == oldScopesLength); 401 assert(scopes.length == oldScopesLength);
401 executables = oldExecutables; 402 executables = oldExecutables;
402 variables = oldVariables; 403 variables = oldVariables;
403 } 404 }
404 405
406 void serializeCodeRange(Object b, AstNode node) {
407 if (b is UnlinkedClassBuilder) {
408 b.hasCodeRange = true;
409 b.codeOffset = node.offset;
410 b.codeLength = node.length;
411 } else if (b is UnlinkedEnumBuilder) {
412 b.hasCodeRange = true;
413 b.codeOffset = node.offset;
414 b.codeLength = node.length;
415 } else if (b is UnlinkedExecutableBuilder) {
416 b.hasCodeRange = true;
417 b.codeOffset = node.offset;
418 b.codeLength = node.length;
419 } else if (b is UnlinkedParamBuilder) {
420 b.hasCodeRange = true;
421 b.codeOffset = node.offset;
422 b.codeLength = node.length;
423 } else if (b is UnlinkedTypedefBuilder) {
424 b.hasCodeRange = true;
425 b.codeOffset = node.offset;
426 b.codeLength = node.length;
427 } else if (b is UnlinkedTypeParamBuilder) {
428 b.hasCodeRange = true;
429 b.codeOffset = node.offset;
430 b.codeLength = node.length;
431 } else if (b is UnlinkedUnitBuilder) {
432 b.hasCodeRange = true;
433 b.codeOffset = node.offset;
434 b.codeLength = node.length;
435 } else if (b is UnlinkedVariableBuilder) {
436 b.hasCodeRange = true;
437 b.codeOffset = node.offset;
438 b.codeLength = node.length;
439 }
440 }
441
405 /** 442 /**
406 * Serialize a [Combinator] into an [UnlinkedCombinator]. 443 * Serialize a [Combinator] into an [UnlinkedCombinator].
407 */ 444 */
408 UnlinkedCombinatorBuilder serializeCombinator(Combinator combinator) { 445 UnlinkedCombinatorBuilder serializeCombinator(Combinator combinator) {
409 UnlinkedCombinatorBuilder b = new UnlinkedCombinatorBuilder(); 446 UnlinkedCombinatorBuilder b = new UnlinkedCombinatorBuilder();
410 if (combinator is ShowCombinator) { 447 if (combinator is ShowCombinator) {
411 b.shows = 448 b.shows =
412 combinator.shownNames.map((SimpleIdentifier id) => id.name).toList(); 449 combinator.shownNames.map((SimpleIdentifier id) => id.name).toList();
413 b.offset = combinator.offset; 450 b.offset = combinator.offset;
414 b.end = combinator.end; 451 b.end = combinator.end;
(...skipping 16 matching lines...) Expand all
431 if (!hasCoreBeenImported) { 468 if (!hasCoreBeenImported) {
432 unlinkedImports.add(new UnlinkedImportBuilder(isImplicit: true)); 469 unlinkedImports.add(new UnlinkedImportBuilder(isImplicit: true));
433 } 470 }
434 compilationUnit.declarations.accept(this); 471 compilationUnit.declarations.accept(this);
435 UnlinkedUnitBuilder b = new UnlinkedUnitBuilder(); 472 UnlinkedUnitBuilder b = new UnlinkedUnitBuilder();
436 b.libraryName = libraryName; 473 b.libraryName = libraryName;
437 b.libraryNameOffset = libraryNameOffset; 474 b.libraryNameOffset = libraryNameOffset;
438 b.libraryNameLength = libraryNameLength; 475 b.libraryNameLength = libraryNameLength;
439 b.libraryDocumentationComment = libraryDocumentationComment; 476 b.libraryDocumentationComment = libraryDocumentationComment;
440 b.libraryAnnotations = libraryAnnotations; 477 b.libraryAnnotations = libraryAnnotations;
478 serializeCodeRange(b, compilationUnit);
441 b.classes = classes; 479 b.classes = classes;
442 b.enums = enums; 480 b.enums = enums;
443 b.executables = executables; 481 b.executables = executables;
444 b.exports = exports; 482 b.exports = exports;
445 b.imports = unlinkedImports; 483 b.imports = unlinkedImports;
446 b.parts = parts; 484 b.parts = parts;
447 b.references = unlinkedReferences; 485 b.references = unlinkedReferences;
448 b.typedefs = typedefs; 486 b.typedefs = typedefs;
449 b.variables = variables; 487 b.variables = variables;
450 b.publicNamespace = computePublicNamespace(compilationUnit); 488 b.publicNamespace = computePublicNamespace(compilationUnit);
(...skipping 27 matching lines...) Expand all
478 text: text, 516 text: text,
479 offset: documentationComment.offset, 517 offset: documentationComment.offset,
480 length: documentationComment.length); 518 length: documentationComment.length);
481 } 519 }
482 520
483 /** 521 /**
484 * Serialize a [FunctionDeclaration] or [MethodDeclaration] into an 522 * Serialize a [FunctionDeclaration] or [MethodDeclaration] into an
485 * [UnlinkedExecutable]. 523 * [UnlinkedExecutable].
486 */ 524 */
487 UnlinkedExecutableBuilder serializeExecutable( 525 UnlinkedExecutableBuilder serializeExecutable(
526 AstNode node,
488 String name, 527 String name,
489 int nameOffset, 528 int nameOffset,
490 bool isGetter, 529 bool isGetter,
491 bool isSetter, 530 bool isSetter,
492 TypeName returnType, 531 TypeName returnType,
493 FormalParameterList formalParameters, 532 FormalParameterList formalParameters,
494 FunctionBody body, 533 FunctionBody body,
495 bool isTopLevel, 534 bool isTopLevel,
496 bool isDeclaredStatic, 535 bool isDeclaredStatic,
497 Comment documentationComment, 536 Comment documentationComment,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 for (int i = 0; i < formalParameters.parameters.length; i++) { 569 for (int i = 0; i < formalParameters.parameters.length; i++) {
531 if (!b.parameters[i].isFunctionTyped && 570 if (!b.parameters[i].isFunctionTyped &&
532 b.parameters[i].type == null) { 571 b.parameters[i].type == null) {
533 b.parameters[i].inferredTypeSlot = assignSlot(); 572 b.parameters[i].inferredTypeSlot = assignSlot();
534 } 573 }
535 } 574 }
536 } 575 }
537 } 576 }
538 b.documentationComment = serializeDocumentation(documentationComment); 577 b.documentationComment = serializeDocumentation(documentationComment);
539 b.annotations = serializeAnnotations(annotations); 578 b.annotations = serializeAnnotations(annotations);
579 serializeCodeRange(b, node);
540 if (returnType == null && !isSemanticallyStatic) { 580 if (returnType == null && !isSemanticallyStatic) {
541 b.inferredReturnTypeSlot = assignSlot(); 581 b.inferredReturnTypeSlot = assignSlot();
542 } 582 }
543 b.visibleOffset = enclosingBlock?.offset; 583 b.visibleOffset = enclosingBlock?.offset;
544 b.visibleLength = enclosingBlock?.length; 584 b.visibleLength = enclosingBlock?.length;
545 serializeFunctionBody(b, body); 585 serializeFunctionBody(b, body);
546 scopes.removeLast(); 586 scopes.removeLast();
547 assert(scopes.length == oldScopesLength); 587 assert(scopes.length == oldScopesLength);
548 return b; 588 return b;
549 } 589 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 648
609 /** 649 /**
610 * Serialize a [FieldFormalParameter], [FunctionTypedFormalParameter], or 650 * Serialize a [FieldFormalParameter], [FunctionTypedFormalParameter], or
611 * [SimpleFormalParameter] into an [UnlinkedParam]. 651 * [SimpleFormalParameter] into an [UnlinkedParam].
612 */ 652 */
613 UnlinkedParamBuilder serializeParameter(NormalFormalParameter node) { 653 UnlinkedParamBuilder serializeParameter(NormalFormalParameter node) {
614 UnlinkedParamBuilder b = new UnlinkedParamBuilder(); 654 UnlinkedParamBuilder b = new UnlinkedParamBuilder();
615 b.name = node.identifier.name; 655 b.name = node.identifier.name;
616 b.nameOffset = node.identifier.offset; 656 b.nameOffset = node.identifier.offset;
617 b.annotations = serializeAnnotations(node.metadata); 657 b.annotations = serializeAnnotations(node.metadata);
658 serializeCodeRange(b, node);
618 switch (node.kind) { 659 switch (node.kind) {
619 case ParameterKind.REQUIRED: 660 case ParameterKind.REQUIRED:
620 b.kind = UnlinkedParamKind.required; 661 b.kind = UnlinkedParamKind.required;
621 break; 662 break;
622 case ParameterKind.POSITIONAL: 663 case ParameterKind.POSITIONAL:
623 b.kind = UnlinkedParamKind.positional; 664 b.kind = UnlinkedParamKind.positional;
624 break; 665 break;
625 case ParameterKind.NAMED: 666 case ParameterKind.NAMED:
626 b.kind = UnlinkedParamKind.named; 667 b.kind = UnlinkedParamKind.named;
627 break; 668 break;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 for (VariableDeclaration variable in variables.variables) { 806 for (VariableDeclaration variable in variables.variables) {
766 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(); 807 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
767 b.isFinal = variables.isFinal; 808 b.isFinal = variables.isFinal;
768 b.isConst = variables.isConst; 809 b.isConst = variables.isConst;
769 b.isStatic = isDeclaredStatic; 810 b.isStatic = isDeclaredStatic;
770 b.name = variable.name.name; 811 b.name = variable.name.name;
771 b.nameOffset = variable.name.offset; 812 b.nameOffset = variable.name.offset;
772 b.type = serializeTypeName(variables.type); 813 b.type = serializeTypeName(variables.type);
773 b.documentationComment = serializeDocumentation(documentationComment); 814 b.documentationComment = serializeDocumentation(documentationComment);
774 b.annotations = serializeAnnotations(annotations); 815 b.annotations = serializeAnnotations(annotations);
816 serializeCodeRange(b, variables.parent);
775 if (variable.isConst || 817 if (variable.isConst ||
776 variable.isFinal && isField && !isDeclaredStatic) { 818 variable.isFinal && isField && !isDeclaredStatic) {
777 Expression initializer = variable.initializer; 819 Expression initializer = variable.initializer;
778 if (initializer != null) { 820 if (initializer != null) {
779 b.constExpr = serializeConstExpr(initializer); 821 b.constExpr = serializeConstExpr(initializer);
780 } 822 }
781 } 823 }
782 if (variable.initializer != null && 824 if (variable.initializer != null &&
783 (variables.isFinal || variables.isConst)) { 825 (variables.isFinal || variables.isConst)) {
784 b.propagatedTypeSlot = assignSlot(); 826 b.propagatedTypeSlot = assignSlot();
(...skipping 16 matching lines...) Expand all
801 enclosingBlock = node; 843 enclosingBlock = node;
802 super.visitBlock(node); 844 super.visitBlock(node);
803 enclosingBlock = oldBlock; 845 enclosingBlock = oldBlock;
804 } 846 }
805 847
806 @override 848 @override
807 void visitClassDeclaration(ClassDeclaration node) { 849 void visitClassDeclaration(ClassDeclaration node) {
808 TypeName superclass = 850 TypeName superclass =
809 node.extendsClause == null ? null : node.extendsClause.superclass; 851 node.extendsClause == null ? null : node.extendsClause.superclass;
810 serializeClass( 852 serializeClass(
853 node,
811 node.abstractKeyword, 854 node.abstractKeyword,
812 node.name.name, 855 node.name.name,
813 node.name.offset, 856 node.name.offset,
814 node.typeParameters, 857 node.typeParameters,
815 superclass, 858 superclass,
816 node.withClause, 859 node.withClause,
817 node.implementsClause, 860 node.implementsClause,
818 node.members, 861 node.members,
819 false, 862 false,
820 node.documentationComment, 863 node.documentationComment,
821 node.metadata); 864 node.metadata);
822 } 865 }
823 866
824 @override 867 @override
825 void visitClassTypeAlias(ClassTypeAlias node) { 868 void visitClassTypeAlias(ClassTypeAlias node) {
826 serializeClass( 869 serializeClass(
870 node,
827 node.abstractKeyword, 871 node.abstractKeyword,
828 node.name.name, 872 node.name.name,
829 node.name.offset, 873 node.name.offset,
830 node.typeParameters, 874 node.typeParameters,
831 node.superclass, 875 node.superclass,
832 node.withClause, 876 node.withClause,
833 node.implementsClause, 877 node.implementsClause,
834 null, 878 null,
835 true, 879 true,
836 node.documentationComment, 880 node.documentationComment,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 b.nameOffset = node.name.offset; 952 b.nameOffset = node.name.offset;
909 b.values = node.constants 953 b.values = node.constants
910 .map((EnumConstantDeclaration value) => new UnlinkedEnumValueBuilder( 954 .map((EnumConstantDeclaration value) => new UnlinkedEnumValueBuilder(
911 documentationComment: 955 documentationComment:
912 serializeDocumentation(value.documentationComment), 956 serializeDocumentation(value.documentationComment),
913 name: value.name.name, 957 name: value.name.name,
914 nameOffset: value.name.offset)) 958 nameOffset: value.name.offset))
915 .toList(); 959 .toList();
916 b.documentationComment = serializeDocumentation(node.documentationComment); 960 b.documentationComment = serializeDocumentation(node.documentationComment);
917 b.annotations = serializeAnnotations(node.metadata); 961 b.annotations = serializeAnnotations(node.metadata);
962 serializeCodeRange(b, node);
918 enums.add(b); 963 enums.add(b);
919 } 964 }
920 965
921 @override 966 @override
922 void visitExportDirective(ExportDirective node) { 967 void visitExportDirective(ExportDirective node) {
923 UnlinkedExportNonPublicBuilder b = new UnlinkedExportNonPublicBuilder( 968 UnlinkedExportNonPublicBuilder b = new UnlinkedExportNonPublicBuilder(
924 uriOffset: node.uri.offset, uriEnd: node.uri.end, offset: node.offset); 969 uriOffset: node.uri.offset, uriEnd: node.uri.end, offset: node.offset);
925 b.annotations = serializeAnnotations(node.metadata); 970 b.annotations = serializeAnnotations(node.metadata);
926 exports.add(b); 971 exports.add(b);
927 } 972 }
(...skipping 15 matching lines...) Expand all
943 } else { 988 } else {
944 b.type = serializeTypeName(node.type); 989 b.type = serializeTypeName(node.type);
945 } 990 }
946 } 991 }
947 return b; 992 return b;
948 } 993 }
949 994
950 @override 995 @override
951 void visitFunctionDeclaration(FunctionDeclaration node) { 996 void visitFunctionDeclaration(FunctionDeclaration node) {
952 executables.add(serializeExecutable( 997 executables.add(serializeExecutable(
998 node,
953 node.name.name, 999 node.name.name,
954 node.name.offset, 1000 node.name.offset,
955 node.isGetter, 1001 node.isGetter,
956 node.isSetter, 1002 node.isSetter,
957 node.returnType, 1003 node.returnType,
958 node.functionExpression.parameters, 1004 node.functionExpression.parameters,
959 node.functionExpression.body, 1005 node.functionExpression.body,
960 true, 1006 true,
961 false, 1007 false,
962 node.documentationComment, 1008 node.documentationComment,
963 node.metadata, 1009 node.metadata,
964 node.functionExpression.typeParameters, 1010 node.functionExpression.typeParameters,
965 node.externalKeyword != null)); 1011 node.externalKeyword != null));
966 } 1012 }
967 1013
968 @override 1014 @override
969 void visitFunctionExpression(FunctionExpression node) { 1015 void visitFunctionExpression(FunctionExpression node) {
970 if (node.parent is! FunctionDeclaration) { 1016 if (node.parent is! FunctionDeclaration) {
971 executables.add(serializeExecutable( 1017 executables.add(serializeExecutable(
1018 node,
972 null, 1019 null,
973 node.offset, 1020 node.offset,
974 false, 1021 false,
975 false, 1022 false,
976 null, 1023 null,
977 node.parameters, 1024 node.parameters,
978 node.body, 1025 node.body,
979 false, 1026 false,
980 false, 1027 false,
981 null, 1028 null,
(...skipping 15 matching lines...) Expand all
997 serializeTypeParameters(node.typeParameters, typeParameterScope); 1044 serializeTypeParameters(node.typeParameters, typeParameterScope);
998 EntityRefBuilder serializedReturnType = serializeTypeName(node.returnType); 1045 EntityRefBuilder serializedReturnType = serializeTypeName(node.returnType);
999 if (serializedReturnType != null) { 1046 if (serializedReturnType != null) {
1000 b.returnType = serializedReturnType; 1047 b.returnType = serializedReturnType;
1001 } 1048 }
1002 b.parameters = node.parameters.parameters 1049 b.parameters = node.parameters.parameters
1003 .map((FormalParameter p) => p.accept(this)) 1050 .map((FormalParameter p) => p.accept(this))
1004 .toList(); 1051 .toList();
1005 b.documentationComment = serializeDocumentation(node.documentationComment); 1052 b.documentationComment = serializeDocumentation(node.documentationComment);
1006 b.annotations = serializeAnnotations(node.metadata); 1053 b.annotations = serializeAnnotations(node.metadata);
1054 serializeCodeRange(b, node);
1007 typedefs.add(b); 1055 typedefs.add(b);
1008 scopes.removeLast(); 1056 scopes.removeLast();
1009 assert(scopes.length == oldScopesLength); 1057 assert(scopes.length == oldScopesLength);
1010 } 1058 }
1011 1059
1012 @override 1060 @override
1013 UnlinkedParamBuilder visitFunctionTypedFormalParameter( 1061 UnlinkedParamBuilder visitFunctionTypedFormalParameter(
1014 FunctionTypedFormalParameter node) { 1062 FunctionTypedFormalParameter node) {
1015 UnlinkedParamBuilder b = serializeParameter(node); 1063 UnlinkedParamBuilder b = serializeParameter(node);
1016 b.isFunctionTyped = true; 1064 b.isFunctionTyped = true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 libraryNameOffset = node.name.offset; 1104 libraryNameOffset = node.name.offset;
1057 libraryNameLength = node.name.length; 1105 libraryNameLength = node.name.length;
1058 libraryDocumentationComment = 1106 libraryDocumentationComment =
1059 serializeDocumentation(node.documentationComment); 1107 serializeDocumentation(node.documentationComment);
1060 libraryAnnotations = serializeAnnotations(node.metadata); 1108 libraryAnnotations = serializeAnnotations(node.metadata);
1061 } 1109 }
1062 1110
1063 @override 1111 @override
1064 void visitMethodDeclaration(MethodDeclaration node) { 1112 void visitMethodDeclaration(MethodDeclaration node) {
1065 executables.add(serializeExecutable( 1113 executables.add(serializeExecutable(
1114 node,
1066 node.name.name, 1115 node.name.name,
1067 node.name.offset, 1116 node.name.offset,
1068 node.isGetter, 1117 node.isGetter,
1069 node.isSetter, 1118 node.isSetter,
1070 node.returnType, 1119 node.returnType,
1071 node.parameters, 1120 node.parameters,
1072 node.body, 1121 node.body,
1073 false, 1122 false,
1074 node.isStatic, 1123 node.isStatic,
1075 node.documentationComment, 1124 node.documentationComment,
(...skipping 28 matching lines...) Expand all
1104 1153
1105 @override 1154 @override
1106 UnlinkedTypeParamBuilder visitTypeParameter(TypeParameter node) { 1155 UnlinkedTypeParamBuilder visitTypeParameter(TypeParameter node) {
1107 UnlinkedTypeParamBuilder b = new UnlinkedTypeParamBuilder(); 1156 UnlinkedTypeParamBuilder b = new UnlinkedTypeParamBuilder();
1108 b.name = node.name.name; 1157 b.name = node.name.name;
1109 b.nameOffset = node.name.offset; 1158 b.nameOffset = node.name.offset;
1110 if (node.bound != null) { 1159 if (node.bound != null) {
1111 b.bound = serializeTypeName(node.bound); 1160 b.bound = serializeTypeName(node.bound);
1112 } 1161 }
1113 b.annotations = serializeAnnotations(node.metadata); 1162 b.annotations = serializeAnnotations(node.metadata);
1163 serializeCodeRange(b, node);
1114 return b; 1164 return b;
1115 } 1165 }
1116 1166
1117 @override 1167 @override
1118 void visitVariableDeclarationStatement(VariableDeclarationStatement node) { 1168 void visitVariableDeclarationStatement(VariableDeclarationStatement node) {
1119 serializeVariables(node.variables, false, null, null, false); 1169 serializeVariables(node.variables, false, null, null, false);
1120 } 1170 }
1121 1171
1122 /** 1172 /**
1123 * Helper method to determine if a given [typeName] refers to `dynamic`. 1173 * Helper method to determine if a given [typeName] refers to `dynamic`.
1124 */ 1174 */
1125 static bool isDynamic(TypeName typeName) { 1175 static bool isDynamic(TypeName typeName) {
1126 Identifier name = typeName.name; 1176 Identifier name = typeName.name;
1127 return name is SimpleIdentifier && name.name == 'dynamic'; 1177 return name is SimpleIdentifier && name.name == 'dynamic';
1128 } 1178 }
1129 } 1179 }
1130 1180
1131 /** 1181 /**
1132 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. 1182 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s.
1133 */ 1183 */
1134 class _TypeParameterScope extends _Scope { 1184 class _TypeParameterScope extends _Scope {
1135 /** 1185 /**
1136 * Get the number of [_ScopedTypeParameter]s defined in this 1186 * Get the number of [_ScopedTypeParameter]s defined in this
1137 * [_TypeParameterScope]. 1187 * [_TypeParameterScope].
1138 */ 1188 */
1139 int get length => _definedNames.length; 1189 int get length => _definedNames.length;
1140 } 1190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698