| 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 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/element_handle.dart'; | 9 import 'package:analyzer/src/generated/element_handle.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 /** | 379 /** |
| 380 * Resynthesize an [ExecutableElement] and place it in the given [holder]. | 380 * Resynthesize an [ExecutableElement] and place it in the given [holder]. |
| 381 */ | 381 */ |
| 382 void buildExecutable(UnlinkedExecutable serializedExecutable, | 382 void buildExecutable(UnlinkedExecutable serializedExecutable, |
| 383 [ElementHolder holder]) { | 383 [ElementHolder holder]) { |
| 384 bool isTopLevel = holder == null; | 384 bool isTopLevel = holder == null; |
| 385 if (holder == null) { | 385 if (holder == null) { |
| 386 holder = unitHolder; | 386 holder = unitHolder; |
| 387 } | 387 } |
| 388 UnlinkedExecutableKind kind = serializedExecutable.kind; |
| 388 String name = serializedExecutable.name; | 389 String name = serializedExecutable.name; |
| 389 if (name.endsWith('=') && name != '[]=') { | 390 if (kind == UnlinkedExecutableKind.setter) { |
| 391 assert(name.endsWith('=')); |
| 390 name = name.substring(0, name.length - 1); | 392 name = name.substring(0, name.length - 1); |
| 391 } | 393 } |
| 392 UnlinkedExecutableKind kind = serializedExecutable.kind; | |
| 393 switch (kind) { | 394 switch (kind) { |
| 394 case UnlinkedExecutableKind.functionOrMethod: | 395 case UnlinkedExecutableKind.functionOrMethod: |
| 395 if (isTopLevel) { | 396 if (isTopLevel) { |
| 396 FunctionElementImpl executableElement = | 397 FunctionElementImpl executableElement = |
| 397 new FunctionElementImpl(name, -1); | 398 new FunctionElementImpl(name, -1); |
| 398 buildExecutableCommonParts(executableElement, serializedExecutable); | 399 buildExecutableCommonParts(executableElement, serializedExecutable); |
| 399 holder.addFunction(executableElement); | 400 holder.addFunction(executableElement); |
| 400 } else { | 401 } else { |
| 401 MethodElementImpl executableElement = new MethodElementImpl(name, -1); | 402 MethodElementImpl executableElement = new MethodElementImpl(name, -1); |
| 402 buildExecutableCommonParts(executableElement, serializedExecutable); | 403 buildExecutableCommonParts(executableElement, serializedExecutable); |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 elementMap[cls.name] = cls; | 918 elementMap[cls.name] = cls; |
| 918 } | 919 } |
| 919 for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) { | 920 for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) { |
| 920 elementMap[typeAlias.name] = typeAlias; | 921 elementMap[typeAlias.name] = typeAlias; |
| 921 } | 922 } |
| 922 resummarizedElements[absoluteUri] = elementMap; | 923 resummarizedElements[absoluteUri] = elementMap; |
| 923 unitHolder = null; | 924 unitHolder = null; |
| 924 prelinkedUnit = null; | 925 prelinkedUnit = null; |
| 925 } | 926 } |
| 926 } | 927 } |
| OLD | NEW |