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

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

Issue 10915083: Change assert implementation to not depend on a top-level function called 'assert'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | runtime/vm/flow_graph.cc » ('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 class Universe { 5 class Universe {
6 Map<Element, CodeBuffer> generatedCode; 6 Map<Element, CodeBuffer> generatedCode;
7 Map<Element, CodeBuffer> generatedBailoutCode; 7 Map<Element, CodeBuffer> generatedBailoutCode;
8 final Set<ClassElement> instantiatedClasses; 8 final Set<ClassElement> instantiatedClasses;
9 final Set<FunctionElement> staticFunctionsNeedingGetter; 9 final Set<FunctionElement> staticFunctionsNeedingGetter;
10 final Map<SourceString, Set<Selector>> invokedNames; 10 final Map<SourceString, Set<Selector>> invokedNames;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool isSetter() => kind === SelectorKind.SETTER; 164 bool isSetter() => kind === SelectorKind.SETTER;
165 bool isCall() => kind === SelectorKind.CALL; 165 bool isCall() => kind === SelectorKind.CALL;
166 166
167 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; 167 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1;
168 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; 168 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2;
169 169
170 bool isOperator() => kind === SelectorKind.OPERATOR; 170 bool isOperator() => kind === SelectorKind.OPERATOR;
171 bool isUnaryOperator() => isOperator() && argumentCount == 0; 171 bool isUnaryOperator() => isOperator() && argumentCount == 0;
172 bool isBinaryOperator() => isOperator() && argumentCount == 1; 172 bool isBinaryOperator() => isOperator() && argumentCount == 1;
173 173
174 /** Check whether this is a call to 'assert' with one positional parameter. */
175 bool isAssertSyntax() {
176 return (isCall() &&
177 name.stringValue === "assert" &&
178 argumentCount == 1 &&
179 namedArgumentCount == 0);
180 }
181
174 int hashCode() => argumentCount + 1000 * namedArguments.length; 182 int hashCode() => argumentCount + 1000 * namedArguments.length;
175 int get namedArgumentCount => namedArguments.length; 183 int get namedArgumentCount => namedArguments.length;
176 int get positionalArgumentCount => argumentCount - namedArgumentCount; 184 int get positionalArgumentCount => argumentCount - namedArgumentCount;
177 DartType get receiverType => null; 185 DartType get receiverType => null;
178 186
179 bool applies(Element element, Compiler compiler) 187 bool applies(Element element, Compiler compiler)
180 => appliesUntyped(element, compiler); 188 => appliesUntyped(element, compiler);
181 189
182 bool appliesUntyped(Element element, Compiler compiler) { 190 bool appliesUntyped(Element element, Compiler compiler) {
183 if (element.isSetter()) return isSetter(); 191 if (element.isSetter()) return isSetter();
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 414
407 if (!self.isInterface() && self.isSubclassOf(other)) { 415 if (!self.isInterface() && self.isSubclassOf(other)) {
408 // Resolve an invocation of [element.name] on [self]. If it 416 // Resolve an invocation of [element.name] on [self]. If it
409 // is found, this selector is a candidate. 417 // is found, this selector is a candidate.
410 return hasElementIn(self, element) && appliesUntyped(element, compiler); 418 return hasElementIn(self, element) && appliesUntyped(element, compiler);
411 } 419 }
412 420
413 return false; 421 return false;
414 } 422 }
415 } 423 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | runtime/vm/flow_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698