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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 /** | 385 /** |
386 * Resynthesize an [ExecutableElement] and place it in the given [holder]. | 386 * Resynthesize an [ExecutableElement] and place it in the given [holder]. |
387 */ | 387 */ |
388 void buildExecutable(UnlinkedExecutable serializedExecutable, | 388 void buildExecutable(UnlinkedExecutable serializedExecutable, |
389 [ElementHolder holder]) { | 389 [ElementHolder holder]) { |
390 bool isTopLevel = holder == null; | 390 bool isTopLevel = holder == null; |
391 if (holder == null) { | 391 if (holder == null) { |
392 holder = unitHolder; | 392 holder = unitHolder; |
393 } | 393 } |
394 String name = serializedExecutable.name; | 394 String name = serializedExecutable.name; |
395 if (name.endsWith('=')) { | 395 if (name.endsWith('=') && name != '[]=') { |
396 name = name.substring(0, name.length - 1); | 396 name = name.substring(0, name.length - 1); |
397 } | 397 } |
398 UnlinkedExecutableKind kind = serializedExecutable.kind; | 398 UnlinkedExecutableKind kind = serializedExecutable.kind; |
399 switch (kind) { | 399 switch (kind) { |
400 case UnlinkedExecutableKind.functionOrMethod: | 400 case UnlinkedExecutableKind.functionOrMethod: |
401 if (isTopLevel) { | 401 if (isTopLevel) { |
402 FunctionElementImpl executableElement = | 402 FunctionElementImpl executableElement = |
403 new FunctionElementImpl(name, -1); | 403 new FunctionElementImpl(name, -1); |
404 buildExecutableCommonParts(executableElement, serializedExecutable); | 404 buildExecutableCommonParts(executableElement, serializedExecutable); |
405 holder.addFunction(executableElement); | 405 holder.addFunction(executableElement); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 elementMap[cls.name] = cls; | 933 elementMap[cls.name] = cls; |
934 } | 934 } |
935 for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) { | 935 for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) { |
936 elementMap[typeAlias.name] = typeAlias; | 936 elementMap[typeAlias.name] = typeAlias; |
937 } | 937 } |
938 resummarizedElements[absoluteUri] = elementMap; | 938 resummarizedElements[absoluteUri] = elementMap; |
939 unitHolder = null; | 939 unitHolder = null; |
940 prelinkedUnit = null; | 940 prelinkedUnit = null; |
941 } | 941 } |
942 } | 942 } |
OLD | NEW |