Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(778)

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 2216873003: Add an "api signature" to summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
11 import 'package:analyzer/dart/element/type.dart'; 11 import 'package:analyzer/dart/element/type.dart';
12 import 'package:analyzer/src/dart/element/element.dart'; 12 import 'package:analyzer/src/dart/element/element.dart';
13 import 'package:analyzer/src/dart/element/member.dart'; 13 import 'package:analyzer/src/dart/element/member.dart';
14 import 'package:analyzer/src/dart/element/type.dart'; 14 import 'package:analyzer/src/dart/element/type.dart';
15 import 'package:analyzer/src/generated/resolver.dart'; 15 import 'package:analyzer/src/generated/resolver.dart';
16 import 'package:analyzer/src/generated/source.dart'; 16 import 'package:analyzer/src/generated/source.dart';
17 import 'package:analyzer/src/generated/utilities_dart.dart'; 17 import 'package:analyzer/src/generated/utilities_dart.dart';
18 import 'package:analyzer/src/summary/flat_buffers.dart';
18 import 'package:analyzer/src/summary/format.dart'; 19 import 'package:analyzer/src/summary/format.dart';
19 import 'package:analyzer/src/summary/idl.dart'; 20 import 'package:analyzer/src/summary/idl.dart';
20 import 'package:analyzer/src/summary/name_filter.dart'; 21 import 'package:analyzer/src/summary/name_filter.dart';
21 import 'package:analyzer/src/summary/summarize_const_expr.dart'; 22 import 'package:analyzer/src/summary/summarize_const_expr.dart';
22 import 'package:convert/convert.dart'; 23 import 'package:convert/convert.dart';
23 import 'package:crypto/crypto.dart'; 24 import 'package:crypto/crypto.dart';
24 import 'package:path/path.dart' as path; 25 import 'package:path/path.dart' as path;
25 26
26 /** 27 /**
27 * Serialize all the elements in [lib] to a summary using [ctx] as the context 28 * Serialize all the elements in [lib] to a summary using [ctx] as the context
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 String uri, UnlinkedUnitBuilder unit, String hash) { 186 String uri, UnlinkedUnitBuilder unit, String hash) {
186 _unlinkedUnitUris.add(uri); 187 _unlinkedUnitUris.add(uri);
187 _unlinkedUnits.add(unit); 188 _unlinkedUnits.add(unit);
188 _unlinkedUnitHashes?.add(hash); 189 _unlinkedUnitHashes?.add(hash);
189 } 190 }
190 191
191 /** 192 /**
192 * Assemble a new [PackageBundleBuilder] using the gathered information. 193 * Assemble a new [PackageBundleBuilder] using the gathered information.
193 */ 194 */
194 PackageBundleBuilder assemble() { 195 PackageBundleBuilder assemble() {
195 return new PackageBundleBuilder( 196 PackageBundleBuilder packageBundle = new PackageBundleBuilder(
196 linkedLibraryUris: _linkedLibraryUris, 197 linkedLibraryUris: _linkedLibraryUris,
197 linkedLibraries: _linkedLibraries, 198 linkedLibraries: _linkedLibraries,
198 unlinkedUnitUris: _unlinkedUnitUris, 199 unlinkedUnitUris: _unlinkedUnitUris,
199 unlinkedUnits: _unlinkedUnits, 200 unlinkedUnits: _unlinkedUnits,
200 unlinkedUnitHashes: _unlinkedUnitHashes, 201 unlinkedUnitHashes: _unlinkedUnitHashes,
201 majorVersion: currentMajorVersion, 202 majorVersion: currentMajorVersion,
202 minorVersion: currentMinorVersion); 203 minorVersion: currentMinorVersion);
204 ApiSignature apiSignature = new ApiSignature();
205 packageBundle.collectApiSignature(apiSignature);
206 packageBundle.apiSignature = apiSignature.toHex();
207 return packageBundle;
203 } 208 }
204 209
205 /** 210 /**
206 * Serialize the library with the given [element]. 211 * Serialize the library with the given [element].
207 */ 212 */
208 void serializeLibraryElement(LibraryElement element) { 213 void serializeLibraryElement(LibraryElement element) {
209 String uri = element.source.uri.toString(); 214 String uri = element.source.uri.toString();
210 LibrarySerializationResult libraryResult = serializeLibrary( 215 LibrarySerializationResult libraryResult = serializeLibrary(
211 element, 216 element,
212 element.context.typeProvider, 217 element.context.typeProvider,
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 exportNames.add(new LinkedExportNameBuilder( 1680 exportNames.add(new LinkedExportNameBuilder(
1676 name: name, 1681 name: name,
1677 dependency: serializeDependency(dependentLibrary), 1682 dependency: serializeDependency(dependentLibrary),
1678 unit: unit, 1683 unit: unit,
1679 kind: kind)); 1684 kind: kind));
1680 } 1685 }
1681 pb.exportNames = exportNames; 1686 pb.exportNames = exportNames;
1682 return pb; 1687 return pb;
1683 } 1688 }
1684 } 1689 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698