OLD | NEW |
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 summary_resynthesizer; | 5 library summary_resynthesizer; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 buildExecutableCommonParts(executableElement, serializedExecutable); | 1042 buildExecutableCommonParts(executableElement, serializedExecutable); |
1043 DartType type; | 1043 DartType type; |
1044 if (kind == UnlinkedExecutableKind.getter) { | 1044 if (kind == UnlinkedExecutableKind.getter) { |
1045 executableElement.getter = true; | 1045 executableElement.getter = true; |
1046 type = executableElement.returnType; | 1046 type = executableElement.returnType; |
1047 } else { | 1047 } else { |
1048 executableElement.setter = true; | 1048 executableElement.setter = true; |
1049 type = executableElement.parameters[0].type; | 1049 type = executableElement.parameters[0].type; |
1050 } | 1050 } |
1051 holder.addAccessor(executableElement); | 1051 holder.addAccessor(executableElement); |
1052 // TODO(paulberry): consider removing implicit variables from the | |
1053 // element model; the spec doesn't call for them, and they cause | |
1054 // trouble when getters/setters exist in different parts. | |
1055 PropertyInducingElementImpl implicitVariable; | 1052 PropertyInducingElementImpl implicitVariable; |
1056 if (isTopLevel) { | 1053 if (isTopLevel) { |
1057 implicitVariable = buildImplicitTopLevelVariable(name, kind, holder); | 1054 implicitVariable = buildImplicitTopLevelVariable(name, kind, holder); |
1058 } else { | 1055 } else { |
1059 FieldElementImpl field = buildImplicitField(name, type, kind, holder); | 1056 FieldElementImpl field = buildImplicitField(name, type, kind, holder); |
1060 field.static = serializedExecutable.isStatic; | 1057 field.static = serializedExecutable.isStatic; |
1061 implicitVariable = field; | 1058 implicitVariable = field; |
1062 } | 1059 } |
1063 executableElement.variable = implicitVariable; | 1060 executableElement.variable = implicitVariable; |
1064 if (kind == UnlinkedExecutableKind.getter) { | 1061 if (kind == UnlinkedExecutableKind.getter) { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 */ | 1504 */ |
1508 DartType buildType(EntityRef type, {bool defaultVoid: false}) { | 1505 DartType buildType(EntityRef type, {bool defaultVoid: false}) { |
1509 if (type == null) { | 1506 if (type == null) { |
1510 if (defaultVoid) { | 1507 if (defaultVoid) { |
1511 return VoidTypeImpl.instance; | 1508 return VoidTypeImpl.instance; |
1512 } else { | 1509 } else { |
1513 return summaryResynthesizer.typeProvider.dynamicType; | 1510 return summaryResynthesizer.typeProvider.dynamicType; |
1514 } | 1511 } |
1515 } | 1512 } |
1516 if (type.paramReference != 0) { | 1513 if (type.paramReference != 0) { |
1517 // TODO(paulberry): make this work for generic methods. | |
1518 return currentTypeParameters[ | 1514 return currentTypeParameters[ |
1519 currentTypeParameters.length - type.paramReference] | 1515 currentTypeParameters.length - type.paramReference] |
1520 .type; | 1516 .type; |
1521 } else { | 1517 } else { |
1522 DartType getTypeArgument(int i) { | 1518 DartType getTypeArgument(int i) { |
1523 if (i < type.typeArguments.length) { | 1519 if (i < type.typeArguments.length) { |
1524 return buildType(type.typeArguments[i]); | 1520 return buildType(type.typeArguments[i]); |
1525 } else { | 1521 } else { |
1526 return summaryResynthesizer.typeProvider.dynamicType; | 1522 return summaryResynthesizer.typeProvider.dynamicType; |
1527 } | 1523 } |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 } | 2038 } |
2043 : () => this.element; | 2039 : () => this.element; |
2044 // TODO(paulberry): Is it a bug that we have to pass `false` for | 2040 // TODO(paulberry): Is it a bug that we have to pass `false` for |
2045 // isInstantiated? | 2041 // isInstantiated? |
2046 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false); | 2042 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false); |
2047 } else { | 2043 } else { |
2048 return null; | 2044 return null; |
2049 } | 2045 } |
2050 } | 2046 } |
2051 } | 2047 } |
OLD | NEW |