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

Side by Side Diff: pkg/compiler/lib/src/constants/values.dart

Issue 1474713002: dart2js cps: Clean up and avoid processing unreachable code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years 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/compiler/lib/src/cps_ir/cps_ir_nodes.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.constants.values; 5 library dart2js.constants.values;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart' 10 import '../elements/elements.dart'
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 final int hashCode; 369 final int hashCode;
370 370
371 // TODO(floitsch): cache StringConstants. 371 // TODO(floitsch): cache StringConstants.
372 // TODO(floitsch): compute hashcode without calling toString() on the 372 // TODO(floitsch): compute hashcode without calling toString() on the
373 // DartString. 373 // DartString.
374 StringConstantValue(DartString value) 374 StringConstantValue(DartString value)
375 : this.primitiveValue = value, 375 : this.primitiveValue = value,
376 this.hashCode = value.slowToString().hashCode; 376 this.hashCode = value.slowToString().hashCode;
377 377
378 StringConstantValue.fromString(String value)
379 : this(new DartString.literal(value));
380
378 bool get isString => true; 381 bool get isString => true;
379 382
380 DartType getType(CoreTypes types) => types.stringType; 383 DartType getType(CoreTypes types) => types.stringType;
381 384
382 bool operator ==(var other) { 385 bool operator ==(var other) {
383 if (other is !StringConstantValue) return false; 386 if (other is !StringConstantValue) return false;
384 StringConstantValue otherString = other; 387 StringConstantValue otherString = other;
385 return hashCode == otherString.hashCode && 388 return hashCode == otherString.hashCode &&
386 primitiveValue == otherString.primitiveValue; 389 primitiveValue == otherString.primitiveValue;
387 } 390 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 List<ConstantValue> getDependencies() => const <ConstantValue>[]; 744 List<ConstantValue> getDependencies() => const <ConstantValue>[];
742 745
743 @override 746 @override
744 DartType getType(CoreTypes types) => const DynamicType(); 747 DartType getType(CoreTypes types) => const DynamicType();
745 748
746 @override 749 @override
747 String toStructuredString() => 'NonConstant'; 750 String toStructuredString() => 'NonConstant';
748 751
749 @override 752 @override
750 String unparse() => '>>non-constant<<'; 753 String unparse() => '>>non-constant<<';
751 } 754 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698