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

Side by Side Diff: lib/compiler/implementation/universe/universe.dart

Issue 11014010: Made assert a keyword. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Renamed Assert to assertHelper. Switched parser to use parseArguments. Added assert argument checki… Created 8 years, 2 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 | Annotate | Revision Log
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('../closure.dart'); 7 #import('../closure.dart');
8 #import('../elements/elements.dart'); 8 #import('../elements/elements.dart');
9 #import('../leg.dart'); 9 #import('../leg.dart');
10 #import('../scanner/scannerlib.dart'); 10 #import('../scanner/scannerlib.dart');
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 bool isSetter() => kind === SelectorKind.SETTER; 194 bool isSetter() => kind === SelectorKind.SETTER;
195 bool isCall() => kind === SelectorKind.CALL; 195 bool isCall() => kind === SelectorKind.CALL;
196 196
197 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; 197 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1;
198 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; 198 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2;
199 199
200 bool isOperator() => kind === SelectorKind.OPERATOR; 200 bool isOperator() => kind === SelectorKind.OPERATOR;
201 bool isUnaryOperator() => isOperator() && argumentCount == 0; 201 bool isUnaryOperator() => isOperator() && argumentCount == 0;
202 bool isBinaryOperator() => isOperator() && argumentCount == 1; 202 bool isBinaryOperator() => isOperator() && argumentCount == 1;
203 203
204 /** Check whether this is a call to 'assert' with one positional parameter. */ 204 /** Check whether this is a call to 'assert'. */
205 bool isAssertSyntax() { 205 bool isAssert() { return (isCall() && name.stringValue === "assert"); }
ahe 2012/10/11 07:19:21 Use => shorthand or add newline after {.
aam-me 2012/10/11 12:26:05 Done.
206 return (isCall() &&
207 name.stringValue === "assert" &&
208 argumentCount == 1 &&
209 namedArgumentCount == 0);
210 }
211 206
212 int hashCode() => argumentCount + 1000 * namedArguments.length; 207 int hashCode() => argumentCount + 1000 * namedArguments.length;
213 int get namedArgumentCount => namedArguments.length; 208 int get namedArgumentCount => namedArguments.length;
214 int get positionalArgumentCount => argumentCount - namedArgumentCount; 209 int get positionalArgumentCount => argumentCount - namedArgumentCount;
215 DartType get receiverType => null; 210 DartType get receiverType => null;
216 211
217 bool applies(Element element, Compiler compiler) 212 bool applies(Element element, Compiler compiler)
218 => appliesUntyped(element, compiler); 213 => appliesUntyped(element, compiler);
219 214
220 bool appliesUntyped(Element element, Compiler compiler) { 215 bool appliesUntyped(Element element, Compiler compiler) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 519
525 if (!self.isInterface() && self.isSubclassOf(other)) { 520 if (!self.isInterface() && self.isSubclassOf(other)) {
526 // Resolve an invocation of [element.name] on [self]. If it 521 // Resolve an invocation of [element.name] on [self]. If it
527 // is found, this selector is a candidate. 522 // is found, this selector is a candidate.
528 return hasElementIn(self, element) && appliesUntyped(element, compiler); 523 return hasElementIn(self, element) && appliesUntyped(element, compiler);
529 } 524 }
530 525
531 return false; 526 return false;
532 } 527 }
533 } 528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698