| 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 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 return b; | 335 return b; |
| 336 } | 336 } |
| 337 | 337 |
| 338 /** | 338 /** |
| 339 * Serialize the given [combinator] into an [UnlinkedCombinator]. | 339 * Serialize the given [combinator] into an [UnlinkedCombinator]. |
| 340 */ | 340 */ |
| 341 UnlinkedCombinatorBuilder serializeCombinator( | 341 UnlinkedCombinatorBuilder serializeCombinator( |
| 342 NamespaceCombinator combinator) { | 342 NamespaceCombinator combinator) { |
| 343 UnlinkedCombinatorBuilder b = new UnlinkedCombinatorBuilder(ctx); | 343 UnlinkedCombinatorBuilder b = new UnlinkedCombinatorBuilder(ctx); |
| 344 if (combinator is ShowElementCombinator) { | 344 if (combinator is ShowElementCombinator) { |
| 345 b.shows = combinator.shownNames.map(serializeCombinatorName).toList(); | 345 b.shows = combinator.shownNames; |
| 346 } else if (combinator is HideElementCombinator) { | 346 } else if (combinator is HideElementCombinator) { |
| 347 b.hides = combinator.hiddenNames.map(serializeCombinatorName).toList(); | 347 b.hides = combinator.hiddenNames; |
| 348 } | 348 } |
| 349 return b; | 349 return b; |
| 350 } | 350 } |
| 351 | 351 |
| 352 /** | 352 /** |
| 353 * Serialize the given [name] into an [UnlinkedCombinatorName]. | |
| 354 */ | |
| 355 UnlinkedCombinatorNameBuilder serializeCombinatorName(String name) { | |
| 356 return encodeUnlinkedCombinatorName(ctx, name: name); | |
| 357 } | |
| 358 | |
| 359 /** | |
| 360 * Return the index of the entry in the dependency table | 353 * Return the index of the entry in the dependency table |
| 361 * ([PrelinkedLibrary.dependencies]) for the given [dependentLibrary]. A new | 354 * ([PrelinkedLibrary.dependencies]) for the given [dependentLibrary]. A new |
| 362 * entry is added to the table if necessary to satisfy the request. | 355 * entry is added to the table if necessary to satisfy the request. |
| 363 */ | 356 */ |
| 364 int serializeDependency(LibraryElement dependentLibrary) { | 357 int serializeDependency(LibraryElement dependentLibrary) { |
| 365 return dependencyMap.putIfAbsent(dependentLibrary, () { | 358 return dependencyMap.putIfAbsent(dependentLibrary, () { |
| 366 int index = dependencies.length; | 359 int index = dependencies.length; |
| 367 dependencies.add(encodePrelinkedDependency(ctx, | 360 dependencies.add(encodePrelinkedDependency(ctx, |
| 368 uri: dependentLibrary.source.uri.toString())); | 361 uri: dependentLibrary.source.uri.toString())); |
| 369 return index; | 362 return index; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); | 633 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); |
| 641 b.name = variable.name; | 634 b.name = variable.name; |
| 642 b.type = serializeTypeRef(variable.type, variable); | 635 b.type = serializeTypeRef(variable.type, variable); |
| 643 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; | 636 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; |
| 644 b.isFinal = variable.isFinal; | 637 b.isFinal = variable.isFinal; |
| 645 b.isConst = variable.isConst; | 638 b.isConst = variable.isConst; |
| 646 b.hasImplicitType = variable.hasImplicitType; | 639 b.hasImplicitType = variable.hasImplicitType; |
| 647 return b; | 640 return b; |
| 648 } | 641 } |
| 649 } | 642 } |
| OLD | NEW |