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

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

Issue 1841433002: Fix summary handling of enum values. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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';
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
151 /** 140 /**
152 * Add a fallback library to the package bundle, corresponding to the library 141 * Add a fallback library to the package bundle, corresponding to the library
153 * whose defining compilation unit is located at [source]. Caller must also 142 * whose defining compilation unit is located at [source]. Caller must also
154 * call [addFallbackUnit] for all compilation units contained in the library 143 * call [addFallbackUnit] for all compilation units contained in the library
155 * (including the defining compilation unit). 144 * (including the defining compilation unit).
156 */ 145 */
157 void addFallbackLibrary(Source source) { 146 void addFallbackLibrary(Source source) {
158 String uri = source.uri.toString(); 147 String uri = source.uri.toString();
159 _linkedLibraryUris.add(uri); 148 _linkedLibraryUris.add(uri);
160 _linkedLibraries.add(new LinkedLibraryBuilder(fallbackMode: true)); 149 _linkedLibraries.add(new LinkedLibraryBuilder(fallbackMode: true));
161 } 150 }
162 151
163 /** 152 /**
164 * Add a fallback compilation unit to the package bundle, corresponding to 153 * Add a fallback compilation unit to the package bundle, corresponding to
165 * the compilation unit located at [source]. 154 * the compilation unit located at [source].
166 */ 155 */
167 void addFallbackUnit(Source source) { 156 void addFallbackUnit(Source source) {
168 String uri = source.uri.toString(); 157 String uri = source.uri.toString();
169 _unlinkedUnitUris.add(uri); 158 _unlinkedUnitUris.add(uri);
170 _unlinkedUnits 159 _unlinkedUnits
171 .add(new UnlinkedUnitBuilder(fallbackModePath: source.fullName)); 160 .add(new UnlinkedUnitBuilder(fallbackModePath: source.fullName));
172 } 161 }
173 162
163 void addLinkedLibrary(String uri, LinkedLibraryBuilder library) {
164 _linkedLibraries.add(library);
165 _linkedLibraryUris.add(uri);
166 }
167
168 void addUnlinkedUnit(Source source, UnlinkedUnitBuilder unit) {
169 _unlinkedUnitUris.add(source.uri.toString());
170 _unlinkedUnits.add(unit);
171 _unlinkedUnitHashes.add(_hash(source.contents.data));
172 }
173
174 /** 174 /**
175 * Assemble a new [PackageBundleBuilder] using the gathered information. 175 * Assemble a new [PackageBundleBuilder] using the gathered information.
176 */ 176 */
177 PackageBundleBuilder assemble() { 177 PackageBundleBuilder assemble() {
178 return new PackageBundleBuilder( 178 return new PackageBundleBuilder(
179 linkedLibraryUris: _linkedLibraryUris, 179 linkedLibraryUris: _linkedLibraryUris,
180 linkedLibraries: _linkedLibraries, 180 linkedLibraries: _linkedLibraries,
181 unlinkedUnitUris: _unlinkedUnitUris, 181 unlinkedUnitUris: _unlinkedUnitUris,
182 unlinkedUnits: _unlinkedUnits, 182 unlinkedUnits: _unlinkedUnits,
183 unlinkedUnitHashes: _unlinkedUnitHashes, 183 unlinkedUnitHashes: _unlinkedUnitHashes,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 names.add(new UnlinkedPublicNameBuilder( 339 names.add(new UnlinkedPublicNameBuilder(
340 kind: ReferenceKind.classOrEnum, 340 kind: ReferenceKind.classOrEnum,
341 name: cls.name, 341 name: cls.name,
342 numTypeParameters: cls.typeParameters.length, 342 numTypeParameters: cls.typeParameters.length,
343 members: serializeClassConstMembers(cls))); 343 members: serializeClassConstMembers(cls)));
344 } 344 }
345 } 345 }
346 for (ClassElement enm in compilationUnit.enums) { 346 for (ClassElement enm in compilationUnit.enums) {
347 if (enm.isPublic) { 347 if (enm.isPublic) {
348 names.add(new UnlinkedPublicNameBuilder( 348 names.add(new UnlinkedPublicNameBuilder(
349 kind: ReferenceKind.classOrEnum, name: enm.name)); 349 kind: ReferenceKind.classOrEnum,
350 name: enm.name,
351 members: serializeClassConstMembers(enm)));
350 } 352 }
351 } 353 }
352 for (FunctionElement function in compilationUnit.functions) { 354 for (FunctionElement function in compilationUnit.functions) {
353 if (function.isPublic) { 355 if (function.isPublic) {
354 names.add(new UnlinkedPublicNameBuilder( 356 names.add(new UnlinkedPublicNameBuilder(
355 kind: ReferenceKind.topLevelFunction, 357 kind: ReferenceKind.topLevelFunction,
356 name: function.name, 358 name: function.name,
357 numTypeParameters: function.typeParameters.length)); 359 numTypeParameters: function.typeParameters.length));
358 } 360 }
359 } 361 }
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 exportNames.add(new LinkedExportNameBuilder( 1616 exportNames.add(new LinkedExportNameBuilder(
1615 name: name, 1617 name: name,
1616 dependency: serializeDependency(dependentLibrary), 1618 dependency: serializeDependency(dependentLibrary),
1617 unit: unit, 1619 unit: unit,
1618 kind: kind)); 1620 kind: kind));
1619 } 1621 }
1620 pb.exportNames = exportNames; 1622 pb.exportNames = exportNames;
1621 return pb; 1623 return pb;
1622 } 1624 }
1623 } 1625 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/public_namespace_computer.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698