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

Side by Side Diff: pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart

Issue 2864363002: Remove DartString from constants. (Closed)
Patch Set: Remove toDartString Created 3 years, 7 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 /// Analysis to determine how to generate code for `LookupMap`s. 5 /// Analysis to determine how to generate code for `LookupMap`s.
6 library compiler.src.js_backend.lookup_map_analysis; 6 library compiler.src.js_backend.lookup_map_analysis;
7 7
8 import 'package:pub_semver/pub_semver.dart'; 8 import 'package:pub_semver/pub_semver.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (value == null) { 139 if (value == null) {
140 reporter.reportHintMessage(lookupMapVersionVariable, 140 reporter.reportHintMessage(lookupMapVersionVariable,
141 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP); 141 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP);
142 return const LookupMapAnalysis._(); 142 return const LookupMapAnalysis._();
143 } 143 }
144 144
145 // TODO(sigmund): add proper version resolution using the pub_semver package 145 // TODO(sigmund): add proper version resolution using the pub_semver package
146 // when we introduce the next version. 146 // when we introduce the next version.
147 Version version; 147 Version version;
148 try { 148 try {
149 version = new Version.parse(value.primitiveValue.slowToString()); 149 version = new Version.parse(value.primitiveValue);
150 } catch (e) {} 150 } catch (e) {}
151 151
152 if (version == null || !_validLookupMapVersionConstraint.allows(version)) { 152 if (version == null || !_validLookupMapVersionConstraint.allows(version)) {
153 reporter.reportHintMessage(lookupMapVersionVariable, 153 reporter.reportHintMessage(lookupMapVersionVariable,
154 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP); 154 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP);
155 return const LookupMapAnalysis._(); 155 return const LookupMapAnalysis._();
156 } 156 }
157 157
158 ClassEntity typeLookupMapClass = 158 ClassEntity typeLookupMapClass =
159 elementEnvironment.lookupClass(analysis.lookupMapLibrary, 'LookupMap'); 159 elementEnvironment.lookupClass(analysis.lookupMapLibrary, 'LookupMap');
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 original.fields[analysis._valueField] = keyValuePairs[1]; 497 original.fields[analysis._valueField] = keyValuePairs[1];
498 } 498 }
499 } else { 499 } else {
500 original.fields[analysis._entriesField] = 500 original.fields[analysis._entriesField] =
501 new ListConstantValue(listType, keyValuePairs); 501 new ListConstantValue(listType, keyValuePairs);
502 } 502 }
503 } 503 }
504 } 504 }
505 505
506 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); 506 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1');
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_system_javascript.dart ('k') | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698