| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 LibraryElement get coreLibrary => typeProvider.objectType.element.library; | 149 LibraryElement get coreLibrary => typeProvider.objectType.element.library; |
| 150 | 150 |
| 151 /** | 151 /** |
| 152 * Add all classes, enums, typedefs, executables, and top level variables | 152 * Add all classes, enums, typedefs, executables, and top level variables |
| 153 * from the given compilation unit [element] to the library summary. | 153 * from the given compilation unit [element] to the library summary. |
| 154 * [unitNum] indicates the ordinal position of this compilation unit in the | 154 * [unitNum] indicates the ordinal position of this compilation unit in the |
| 155 * library. | 155 * library. |
| 156 */ | 156 */ |
| 157 void addCompilationUnitElements(CompilationUnitElement element, int unitNum) { | 157 void addCompilationUnitElements(CompilationUnitElement element, int unitNum) { |
| 158 UnlinkedUnitBuilder b = new UnlinkedUnitBuilder(ctx); | 158 UnlinkedUnitBuilder b = new UnlinkedUnitBuilder(ctx); |
| 159 referenceMap.clear(); |
| 159 unlinkedReferences = <UnlinkedReferenceBuilder>[ | 160 unlinkedReferences = <UnlinkedReferenceBuilder>[ |
| 160 encodeUnlinkedReference(ctx) | 161 encodeUnlinkedReference(ctx) |
| 161 ]; | 162 ]; |
| 162 prelinkedReferences = <PrelinkedReferenceBuilder>[ | 163 prelinkedReferences = <PrelinkedReferenceBuilder>[ |
| 163 encodePrelinkedReference(ctx, kind: PrelinkedReferenceKind.classOrEnum) | 164 encodePrelinkedReference(ctx, kind: PrelinkedReferenceKind.classOrEnum) |
| 164 ]; | 165 ]; |
| 165 if (unitNum == 0) { | 166 if (unitNum == 0) { |
| 166 // TODO(paulberry): we need to figure out a way to record library, part, | 167 // TODO(paulberry): we need to figure out a way to record library, part, |
| 167 // import, and export declarations that appear in non-defining | 168 // import, and export declarations that appear in non-defining |
| 168 // compilation units (even though such declarations are prohibited by the | 169 // compilation units (even though such declarations are prohibited by the |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); | 605 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); |
| 605 b.name = variable.name; | 606 b.name = variable.name; |
| 606 b.type = serializeTypeRef(variable.type, variable); | 607 b.type = serializeTypeRef(variable.type, variable); |
| 607 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; | 608 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; |
| 608 b.isFinal = variable.isFinal; | 609 b.isFinal = variable.isFinal; |
| 609 b.isConst = variable.isConst; | 610 b.isConst = variable.isConst; |
| 610 b.hasImplicitType = variable.hasImplicitType; | 611 b.hasImplicitType = variable.hasImplicitType; |
| 611 return b; | 612 return b; |
| 612 } | 613 } |
| 613 } | 614 } |
| OLD | NEW |