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

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

Issue 1540533002: Fix for typedef-typed field formal parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/type.dart'; 9 import 'package:analyzer/src/dart/element/type.dart';
10 import 'package:analyzer/src/generated/resolver.dart'; 10 import 'package:analyzer/src/generated/resolver.dart';
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 pb.units = prelinkedUnits; 441 pb.units = prelinkedUnits;
442 pb.dependencies = dependencies; 442 pb.dependencies = dependencies;
443 pb.importDependencies = prelinkedImports; 443 pb.importDependencies = prelinkedImports;
444 return pb; 444 return pb;
445 } 445 }
446 446
447 /** 447 /**
448 * Serialize the given [parameter] into an [UnlinkedParam]. 448 * Serialize the given [parameter] into an [UnlinkedParam].
449 */ 449 */
450 UnlinkedParamBuilder serializeParam(ParameterElement parameter) { 450 UnlinkedParamBuilder serializeParam(ParameterElement parameter,
451 [Element context]) {
452 context ??= parameter;
451 UnlinkedParamBuilder b = new UnlinkedParamBuilder(ctx); 453 UnlinkedParamBuilder b = new UnlinkedParamBuilder(ctx);
452 b.name = parameter.name; 454 b.name = parameter.name;
453 switch (parameter.parameterKind) { 455 switch (parameter.parameterKind) {
454 case ParameterKind.REQUIRED: 456 case ParameterKind.REQUIRED:
455 b.kind = UnlinkedParamKind.required; 457 b.kind = UnlinkedParamKind.required;
456 break; 458 break;
457 case ParameterKind.POSITIONAL: 459 case ParameterKind.POSITIONAL:
458 b.kind = UnlinkedParamKind.positional; 460 b.kind = UnlinkedParamKind.positional;
459 break; 461 break;
460 case ParameterKind.NAMED: 462 case ParameterKind.NAMED:
461 b.kind = UnlinkedParamKind.named; 463 b.kind = UnlinkedParamKind.named;
462 break; 464 break;
463 } 465 }
464 b.isInitializingFormal = parameter.isInitializingFormal; 466 b.isInitializingFormal = parameter.isInitializingFormal;
465 DartType type = parameter.type; 467 DartType type = parameter.type;
466 if (type is FunctionType) { 468 if (type is FunctionType) {
467 b.isFunctionTyped = true; 469 b.isFunctionTyped = true;
468 if (!type.returnType.isVoid) { 470 if (!type.returnType.isVoid) {
469 b.type = serializeTypeRef(type.returnType, parameter); 471 b.type = serializeTypeRef(type.returnType, parameter);
470 } 472 }
471 b.parameters = type.parameters.map(serializeParam).toList(); 473 b.parameters = type.parameters
474 .map((parameter) => serializeParam(parameter, context))
475 .toList();
472 } else { 476 } else {
473 b.type = serializeTypeRef(type, parameter); 477 b.type = serializeTypeRef(type, context);
474 b.hasImplicitType = parameter.hasImplicitType; 478 b.hasImplicitType = parameter.hasImplicitType;
475 } 479 }
476 return b; 480 return b;
477 } 481 }
478 482
479 /** 483 /**
480 * Serialize the given [prefix] into an index into the references table. 484 * Serialize the given [prefix] into an index into the references table.
481 */ 485 */
482 int serializePrefix(PrefixElement element) { 486 int serializePrefix(PrefixElement element) {
483 return referenceMap.putIfAbsent(element, () { 487 return referenceMap.putIfAbsent(element, () {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); 604 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx);
601 b.name = variable.name; 605 b.name = variable.name;
602 b.type = serializeTypeRef(variable.type, variable); 606 b.type = serializeTypeRef(variable.type, variable);
603 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; 607 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement;
604 b.isFinal = variable.isFinal; 608 b.isFinal = variable.isFinal;
605 b.isConst = variable.isConst; 609 b.isConst = variable.isConst;
606 b.hasImplicitType = variable.hasImplicitType; 610 b.hasImplicitType = variable.hasImplicitType;
607 return b; 611 return b;
608 } 612 }
609 } 613 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698