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

Side by Side Diff: frog/type.dart

Issue 8763001: Fix names with '$' to not conflict with operators or internal helpers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged again Created 9 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 | Annotate | Revision Log
« no previous file with comments | « frog/token_kind.g.dart ('k') | frog/value.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
None
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class Type extends Element { 5 class Type extends Element {
6 bool isTested = false; 6 bool isTested = false;
7 bool isChecked = false; 7 bool isChecked = false;
8 8
9 /** 9 /**
10 * For core types (int, String, etc) this is the generated type assertion 10 * For core types (int, String, etc) this is the generated type assertion
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // True for all types in the Dart type system. We track non-nullabiltity 60 // True for all types in the Dart type system. We track non-nullabiltity
61 // as an optimization for booleans to generate better code in checked mode. 61 // as an optimization for booleans to generate better code in checked mode.
62 bool get isNullable() => true; 62 bool get isNullable() => true;
63 63
64 // Strangely Dart treats calls on Function much like calls on var. 64 // Strangely Dart treats calls on Function much like calls on var.
65 bool get isVarOrFunction() => isVar || isFunction; 65 bool get isVarOrFunction() => isVar || isFunction;
66 66
67 bool get isVarOrObject() => isVar || isObject; 67 bool get isVarOrObject() => isVar || isObject;
68 68
69 /** Gets the $call method for a function type. */ 69 /** Gets the :call method for a function type. */
70 MethodMember getCallMethod() => null; 70 MethodMember getCallMethod() => null;
71 71
72 /** These types may not be implemented or extended by user code. */ 72 /** These types may not be implemented or extended by user code. */
73 bool get isClosed() => isString || isBool || isNum || isFunction || isVar; 73 bool get isClosed() => isString || isBool || isNum || isFunction || isVar;
74 74
75 bool get isUsed() => false; 75 bool get isUsed() => false;
76 76
77 bool get isGeneric() => false; 77 bool get isGeneric() => false;
78 78
79 bool get isHiddenNativeType() => false; 79 bool get isHiddenNativeType() => false;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (parentMember != null) { 111 if (parentMember != null) {
112 // TODO(jimhug): Ensure that this is only done once. 112 // TODO(jimhug): Ensure that this is only done once.
113 if (!member.isPrivate || member.library == parentMember.library) { 113 if (!member.isPrivate || member.library == parentMember.library) {
114 member.override(parentMember); 114 member.override(parentMember);
115 } 115 }
116 } 116 }
117 } 117 }
118 118
119 Member _createNotEqualMember() { 119 Member _createNotEqualMember() {
120 // Add a != method just like the == one. 120 // Add a != method just like the == one.
121 MethodMember eq = members['\$eq']; 121 MethodMember eq = members[':eq'];
122 if (eq == null) { 122 if (eq == null) {
123 world.internalError('INTERNAL: object does not define ==', 123 world.internalError('INTERNAL: object does not define ==',
124 definition.span); 124 definition.span);
125 } 125 }
126 final ne = new MethodMember('\$ne', this, eq.definition); 126 final ne = new MethodMember(':ne', this, eq.definition);
127 ne.isGenerated = true; 127 ne.isGenerated = true;
128 ne.returnType = eq.returnType; 128 ne.returnType = eq.returnType;
129 ne.parameters = eq.parameters; 129 ne.parameters = eq.parameters;
130 ne.isStatic = eq.isStatic; 130 ne.isStatic = eq.isStatic;
131 ne.isAbstract = eq.isAbstract; 131 ne.isAbstract = eq.isAbstract;
132 // TODO - What else to fill in? 132 // TODO - What else to fill in?
133 return ne; 133 return ne;
134 } 134 }
135 135
136 Member _getMemberInParents(String memberName) { 136 Member _getMemberInParents(String memberName) {
137 // print('getting $memberName in parents of $name, $isClass'); 137 // print('getting $memberName in parents of $name, $isClass');
138 // Now look in my parents. 138 // Now look in my parents.
139 if (isClass) { 139 if (isClass) {
140 if (parent != null) { 140 if (parent != null) {
141 return parent.getMember(memberName); 141 return parent.getMember(memberName);
142 } else if (isObject) { // Could also be a top type so need check. 142 } else if (isObject) { // Could also be a top type so need check.
143 // Create synthetic != method if needed. 143 // Create synthetic != method if needed.
144 if (memberName == '\$ne') { 144 if (memberName == ':ne') {
145 var ret = _createNotEqualMember(); 145 var ret = _createNotEqualMember();
146 members[memberName] = ret; 146 members[memberName] = ret;
147 return ret; 147 return ret;
148 } 148 }
149 return null; 149 return null;
150 } 150 }
151 } else { 151 } else {
152 // TODO(jimhug): Will probably check types more than once - errors? 152 // TODO(jimhug): Will probably check types more than once - errors?
153 if (interfaces != null && interfaces.length > 0) { 153 if (interfaces != null && interfaces.length > 0) {
154 for (var i in interfaces) { 154 for (var i in interfaces) {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 else if (isNum) return 'number'; 780 else if (isNum) return 'number';
781 else if (isString) return 'string'; 781 else if (isString) return 'string';
782 else if (isFunction) return 'function'; 782 else if (isFunction) return 'function';
783 else return null; 783 else return null;
784 } 784 }
785 785
786 // TODO(jimhug): Reconcile different number types on JS. 786 // TODO(jimhug): Reconcile different number types on JS.
787 bool get isNum() { 787 bool get isNum() {
788 return library != null && library.isCore && 788 return library != null && library.isCore &&
789 (name == 'num' || name == 'int' || name == 'double'); 789 (name == 'num' || name == 'int' || name == 'double');

error: old chunk mismatch

OLDNEW
« no previous file with comments | « frog/token_kind.g.dart ('k') | frog/value.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698