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

Side by Side Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Reintroduce assertHelper for asserts without messages. Created 5 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
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 universe; 5 library universe;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Identifiers, 10 Identifiers,
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 bool get isSetter => kind == SelectorKind.SETTER; 819 bool get isSetter => kind == SelectorKind.SETTER;
820 bool get isCall => kind == SelectorKind.CALL; 820 bool get isCall => kind == SelectorKind.CALL;
821 bool get isClosureCall => isCall && memberName == CALL_NAME; 821 bool get isClosureCall => isCall && memberName == CALL_NAME;
822 822
823 bool get isIndex => kind == SelectorKind.INDEX && argumentCount == 1; 823 bool get isIndex => kind == SelectorKind.INDEX && argumentCount == 1;
824 bool get isIndexSet => kind == SelectorKind.INDEX && argumentCount == 2; 824 bool get isIndexSet => kind == SelectorKind.INDEX && argumentCount == 2;
825 825
826 bool get isOperator => kind == SelectorKind.OPERATOR; 826 bool get isOperator => kind == SelectorKind.OPERATOR;
827 bool get isUnaryOperator => isOperator && argumentCount == 0; 827 bool get isUnaryOperator => isOperator && argumentCount == 0;
828 828
829 /** Check whether this is a call to 'assert'. */
830 bool get isAssert => isCall && identical(name, "assert");
831
832 /** 829 /**
833 * The member name for invocation mirrors created from this selector. 830 * The member name for invocation mirrors created from this selector.
834 */ 831 */
835 String get invocationMirrorMemberName => 832 String get invocationMirrorMemberName =>
836 isSetter ? '$name=' : name; 833 isSetter ? '$name=' : name;
837 834
838 int get invocationMirrorKind { 835 int get invocationMirrorKind {
839 const int METHOD = 0; 836 const int METHOD = 0;
840 const int GETTER = 1; 837 const int GETTER = 1;
841 const int SETTER = 2; 838 const int SETTER = 2;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 } 872 }
876 873
877 bool signatureApplies(FunctionElement function) { 874 bool signatureApplies(FunctionElement function) {
878 if (Elements.isUnresolved(function)) return false; 875 if (Elements.isUnresolved(function)) return false;
879 return callStructure.signatureApplies(function.functionSignature); 876 return callStructure.signatureApplies(function.functionSignature);
880 } 877 }
881 878
882 bool sameNameHack(Element element, World world) { 879 bool sameNameHack(Element element, World world) {
883 // TODO(ngeoffray): Remove workaround checks. 880 // TODO(ngeoffray): Remove workaround checks.
884 return element.isConstructor || 881 return element.isConstructor ||
885 name == element.name || 882 name == element.name;
886 name == 'assert' && world.isAssertMethod(element);
887 } 883 }
888 884
889 bool applies(Element element, World world) { 885 bool applies(Element element, World world) {
890 if (!sameNameHack(element, world)) return false; 886 if (!sameNameHack(element, world)) return false;
891 return appliesUnnamed(element, world); 887 return appliesUnnamed(element, world);
892 } 888 }
893 889
894 bool match(SelectorKind kind, 890 bool match(SelectorKind kind,
895 Name memberName, 891 Name memberName,
896 CallStructure callStructure) { 892 CallStructure callStructure) {
(...skipping 10 matching lines...) Expand all
907 // Add bits from the call structure. 903 // Add bits from the call structure.
908 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); 904 return Hashing.mixHashCodeBits(hash, callStructure.hashCode);
909 } 905 }
910 906
911 String toString() { 907 String toString() {
912 return 'Selector($kind, $name, ${callStructure.structureToString()})'; 908 return 'Selector($kind, $name, ${callStructure.structureToString()})';
913 } 909 }
914 910
915 Selector toCallSelector() => new Selector.callClosureFrom(this); 911 Selector toCallSelector() => new Selector.callClosureFrom(this);
916 } 912 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698