| 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/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 void buildClass(UnlinkedClass serializedClass) { | 311 void buildClass(UnlinkedClass serializedClass) { |
| 312 try { | 312 try { |
| 313 currentTypeParameters = | 313 currentTypeParameters = |
| 314 serializedClass.typeParameters.map(buildTypeParameter).toList(); | 314 serializedClass.typeParameters.map(buildTypeParameter).toList(); |
| 315 for (int i = 0; i < serializedClass.typeParameters.length; i++) { | 315 for (int i = 0; i < serializedClass.typeParameters.length; i++) { |
| 316 finishTypeParameter( | 316 finishTypeParameter( |
| 317 serializedClass.typeParameters[i], currentTypeParameters[i]); | 317 serializedClass.typeParameters[i], currentTypeParameters[i]); |
| 318 } | 318 } |
| 319 ClassElementImpl classElement = new ClassElementImpl( | 319 ClassElementImpl classElement = new ClassElementImpl( |
| 320 serializedClass.name, serializedClass.nameOffset); | 320 serializedClass.name, serializedClass.nameOffset); |
| 321 classElement.abstract = serializedClass.isAbstract; |
| 321 classElement.mixinApplication = serializedClass.isMixinApplication; | 322 classElement.mixinApplication = serializedClass.isMixinApplication; |
| 322 InterfaceTypeImpl correspondingType = new InterfaceTypeImpl(classElement); | 323 InterfaceTypeImpl correspondingType = new InterfaceTypeImpl(classElement); |
| 323 if (serializedClass.supertype != null) { | 324 if (serializedClass.supertype != null) { |
| 324 classElement.supertype = buildType(serializedClass.supertype); | 325 classElement.supertype = buildType(serializedClass.supertype); |
| 325 } else if (!serializedClass.hasNoSupertype) { | 326 } else if (!serializedClass.hasNoSupertype) { |
| 326 if (isCoreLibrary) { | 327 if (isCoreLibrary) { |
| 327 delayedObjectSubclasses.add(classElement); | 328 delayedObjectSubclasses.add(classElement); |
| 328 } else { | 329 } else { |
| 329 classElement.supertype = summaryResynthesizer.typeProvider.objectType; | 330 classElement.supertype = summaryResynthesizer.typeProvider.objectType; |
| 330 } | 331 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 switch (kind) { | 492 switch (kind) { |
| 492 case UnlinkedExecutableKind.functionOrMethod: | 493 case UnlinkedExecutableKind.functionOrMethod: |
| 493 if (isTopLevel) { | 494 if (isTopLevel) { |
| 494 FunctionElementImpl executableElement = | 495 FunctionElementImpl executableElement = |
| 495 new FunctionElementImpl(name, serializedExecutable.nameOffset); | 496 new FunctionElementImpl(name, serializedExecutable.nameOffset); |
| 496 buildExecutableCommonParts(executableElement, serializedExecutable); | 497 buildExecutableCommonParts(executableElement, serializedExecutable); |
| 497 holder.addFunction(executableElement); | 498 holder.addFunction(executableElement); |
| 498 } else { | 499 } else { |
| 499 MethodElementImpl executableElement = | 500 MethodElementImpl executableElement = |
| 500 new MethodElementImpl(name, serializedExecutable.nameOffset); | 501 new MethodElementImpl(name, serializedExecutable.nameOffset); |
| 502 executableElement.abstract = serializedExecutable.isAbstract; |
| 501 buildExecutableCommonParts(executableElement, serializedExecutable); | 503 buildExecutableCommonParts(executableElement, serializedExecutable); |
| 502 executableElement.static = serializedExecutable.isStatic; | 504 executableElement.static = serializedExecutable.isStatic; |
| 503 holder.addMethod(executableElement); | 505 holder.addMethod(executableElement); |
| 504 } | 506 } |
| 505 break; | 507 break; |
| 506 case UnlinkedExecutableKind.getter: | 508 case UnlinkedExecutableKind.getter: |
| 507 case UnlinkedExecutableKind.setter: | 509 case UnlinkedExecutableKind.setter: |
| 508 PropertyAccessorElementImpl executableElement = | 510 PropertyAccessorElementImpl executableElement = |
| 509 new PropertyAccessorElementImpl( | 511 new PropertyAccessorElementImpl( |
| 510 name, serializedExecutable.nameOffset); | 512 name, serializedExecutable.nameOffset); |
| 511 if (isTopLevel) { | 513 if (isTopLevel) { |
| 512 executableElement.static = true; | 514 executableElement.static = true; |
| 513 } else { | 515 } else { |
| 514 executableElement.static = serializedExecutable.isStatic; | 516 executableElement.static = serializedExecutable.isStatic; |
| 517 executableElement.abstract = serializedExecutable.isAbstract; |
| 515 } | 518 } |
| 516 buildExecutableCommonParts(executableElement, serializedExecutable); | 519 buildExecutableCommonParts(executableElement, serializedExecutable); |
| 517 DartType type; | 520 DartType type; |
| 518 if (kind == UnlinkedExecutableKind.getter) { | 521 if (kind == UnlinkedExecutableKind.getter) { |
| 519 executableElement.getter = true; | 522 executableElement.getter = true; |
| 520 type = executableElement.returnType; | 523 type = executableElement.returnType; |
| 521 } else { | 524 } else { |
| 522 executableElement.setter = true; | 525 executableElement.setter = true; |
| 523 type = executableElement.parameters[0].type; | 526 type = executableElement.parameters[0].type; |
| 524 } | 527 } |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 for (PropertyAccessorElementImpl accessor in unit.accessors) { | 1205 for (PropertyAccessorElementImpl accessor in unit.accessors) { |
| 1203 elementMap[accessor.identifier] = accessor; | 1206 elementMap[accessor.identifier] = accessor; |
| 1204 } | 1207 } |
| 1205 resummarizedElements[absoluteUri] = elementMap; | 1208 resummarizedElements[absoluteUri] = elementMap; |
| 1206 unitHolder = null; | 1209 unitHolder = null; |
| 1207 linkedUnit = null; | 1210 linkedUnit = null; |
| 1208 unlinkedUnit = null; | 1211 unlinkedUnit = null; |
| 1209 linkedTypeMap = null; | 1212 linkedTypeMap = null; |
| 1210 } | 1213 } |
| 1211 } | 1214 } |
| OLD | NEW |