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

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

Issue 2356523002: Remove fallback mode and corresponding cli flag. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/build_mode.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/api_signature.dart'; 18 import 'package:analyzer/src/summary/api_signature.dart';
19 import 'package:analyzer/src/summary/format.dart'; 19 import 'package:analyzer/src/summary/format.dart';
20 import 'package:analyzer/src/summary/idl.dart'; 20 import 'package:analyzer/src/summary/idl.dart';
21 import 'package:analyzer/src/summary/name_filter.dart'; 21 import 'package:analyzer/src/summary/name_filter.dart';
22 import 'package:analyzer/src/summary/package_bundle_reader.dart'; 22 import 'package:analyzer/src/summary/package_bundle_reader.dart';
23 import 'package:analyzer/src/summary/summarize_const_expr.dart'; 23 import 'package:analyzer/src/summary/summarize_const_expr.dart';
24 import 'package:convert/convert.dart'; 24 import 'package:convert/convert.dart';
25 import 'package:crypto/crypto.dart'; 25 import 'package:crypto/crypto.dart';
26 import 'package:path/path.dart' as path;
27 26
28 /** 27 /**
29 * 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
30 * for building the summary, and using [typeProvider] to find built-in types. 29 * for building the summary, and using [typeProvider] to find built-in types.
31 */ 30 */
32 LibrarySerializationResult serializeLibrary( 31 LibrarySerializationResult serializeLibrary(
33 LibraryElement lib, TypeProvider typeProvider, bool strongMode) { 32 LibraryElement lib, TypeProvider typeProvider, bool strongMode) {
34 _LibrarySerializer serializer = 33 _LibrarySerializer serializer =
35 new _LibrarySerializer(lib, typeProvider, strongMode); 34 new _LibrarySerializer(lib, typeProvider, strongMode);
36 LinkedLibraryBuilder linked = serializer.serializeLibrary(); 35 LinkedLibraryBuilder linked = serializer.serializeLibrary();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 final bool _excludeHashes; 146 final bool _excludeHashes;
148 147
149 /** 148 /**
150 * Create a [PackageBundleAssembler]. If [excludeHashes] is `true`, hash 149 * Create a [PackageBundleAssembler]. If [excludeHashes] is `true`, hash
151 * computation will be skipped. 150 * computation will be skipped.
152 */ 151 */
153 PackageBundleAssembler({bool excludeHashes: false}) 152 PackageBundleAssembler({bool excludeHashes: false})
154 : _excludeHashes = excludeHashes, 153 : _excludeHashes = excludeHashes,
155 _unlinkedUnitHashes = excludeHashes ? null : <String>[]; 154 _unlinkedUnitHashes = excludeHashes ? null : <String>[];
156 155
157 /**
158 * Add a fallback library to the package bundle, corresponding to the library
159 * whose defining compilation unit is located at [source]. Caller must also
160 * call [addFallbackUnit] for all compilation units contained in the library
161 * (including the defining compilation unit).
162 */
163 void addFallbackLibrary(Source source) {
164 String uri = source.uri.toString();
165 _linkedLibraryUris.add(uri);
166 _linkedLibraries.add(new LinkedLibraryBuilder(fallbackMode: true));
167 }
168
169 /**
170 * Add a fallback compilation unit to the package bundle, corresponding to
171 * the compilation unit located at [source].
172 */
173 void addFallbackUnit(Source source) {
174 String uri = source.uri.toString();
175 UnlinkedUnitBuilder unit = new UnlinkedUnitBuilder(
176 fallbackModePath: path.relative(source.fullName));
177 _unlinkedUnitUris.add(uri);
178 _unlinkedUnits.add(unit);
179 _unlinkedUnitMap[uri] = unit;
180 }
181
182 void addLinkedLibrary(String uri, LinkedLibraryBuilder library) { 156 void addLinkedLibrary(String uri, LinkedLibraryBuilder library) {
183 _linkedLibraries.add(library); 157 _linkedLibraries.add(library);
184 _linkedLibraryUris.add(uri); 158 _linkedLibraryUris.add(uri);
185 } 159 }
186 160
187 void addUnlinkedUnit(Source source, UnlinkedUnitBuilder unit) { 161 void addUnlinkedUnit(Source source, UnlinkedUnitBuilder unit) {
188 addUnlinkedUnitWithHash(source.uri.toString(), unit, 162 addUnlinkedUnitWithHash(source.uri.toString(), unit,
189 _excludeHashes ? null : _hash(source.contents.data)); 163 _excludeHashes ? null : _hash(source.contents.data));
190 } 164 }
191 165
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 exportNames.add(new LinkedExportNameBuilder( 1684 exportNames.add(new LinkedExportNameBuilder(
1711 name: name, 1685 name: name,
1712 dependency: serializeDependency(dependentLibrary), 1686 dependency: serializeDependency(dependentLibrary),
1713 unit: unit, 1687 unit: unit,
1714 kind: kind)); 1688 kind: kind));
1715 } 1689 }
1716 pb.exportNames = exportNames; 1690 pb.exportNames = exportNames;
1717 return pb; 1691 return pb;
1718 } 1692 }
1719 } 1693 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/build_mode.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698