| 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 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 * by 1. | 130 * by 1. |
| 131 */ | 131 */ |
| 132 static const int currentMinorVersion = 0; | 132 static const int currentMinorVersion = 0; |
| 133 | 133 |
| 134 final List<String> _linkedLibraryUris = <String>[]; | 134 final List<String> _linkedLibraryUris = <String>[]; |
| 135 final List<LinkedLibraryBuilder> _linkedLibraries = <LinkedLibraryBuilder>[]; | 135 final List<LinkedLibraryBuilder> _linkedLibraries = <LinkedLibraryBuilder>[]; |
| 136 final List<String> _unlinkedUnitUris = <String>[]; | 136 final List<String> _unlinkedUnitUris = <String>[]; |
| 137 final List<UnlinkedUnitBuilder> _unlinkedUnits = <UnlinkedUnitBuilder>[]; | 137 final List<UnlinkedUnitBuilder> _unlinkedUnits = <UnlinkedUnitBuilder>[]; |
| 138 final List<String> _unlinkedUnitHashes = <String>[]; | 138 final List<String> _unlinkedUnitHashes = <String>[]; |
| 139 | 139 |
| 140 void addLinkedLibrary(String uri, LinkedLibraryBuilder library) { |
| 141 _linkedLibraries.add(library); |
| 142 _linkedLibraryUris.add(uri); |
| 143 } |
| 144 |
| 145 void addUnlinkedUnit(Source source, UnlinkedUnitBuilder unit) { |
| 146 _unlinkedUnitUris.add(source.uri.toString()); |
| 147 _unlinkedUnits.add(unit); |
| 148 _unlinkedUnitHashes.add(_hash(source.contents.data)); |
| 149 } |
| 150 |
| 140 /** | 151 /** |
| 141 * Add a fallback library to the package bundle, corresponding to the library | 152 * Add a fallback library to the package bundle, corresponding to the library |
| 142 * whose defining compilation unit is located at [source]. Caller must also | 153 * whose defining compilation unit is located at [source]. Caller must also |
| 143 * call [addFallbackUnit] for all compilation units contained in the library | 154 * call [addFallbackUnit] for all compilation units contained in the library |
| 144 * (including the defining compilation unit). | 155 * (including the defining compilation unit). |
| 145 */ | 156 */ |
| 146 void addFallbackLibrary(Source source) { | 157 void addFallbackLibrary(Source source) { |
| 147 String uri = source.uri.toString(); | 158 String uri = source.uri.toString(); |
| 148 _linkedLibraryUris.add(uri); | 159 _linkedLibraryUris.add(uri); |
| 149 _linkedLibraries.add(new LinkedLibraryBuilder(fallbackMode: true)); | 160 _linkedLibraries.add(new LinkedLibraryBuilder(fallbackMode: true)); |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 exportNames.add(new LinkedExportNameBuilder( | 1614 exportNames.add(new LinkedExportNameBuilder( |
| 1604 name: name, | 1615 name: name, |
| 1605 dependency: serializeDependency(dependentLibrary), | 1616 dependency: serializeDependency(dependentLibrary), |
| 1606 unit: unit, | 1617 unit: unit, |
| 1607 kind: kind)); | 1618 kind: kind)); |
| 1608 } | 1619 } |
| 1609 pb.exportNames = exportNames; | 1620 pb.exportNames = exportNames; |
| 1610 return pb; | 1621 return pb; |
| 1611 } | 1622 } |
| 1612 } | 1623 } |
| OLD | NEW |