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

Side by Side Diff: frog/leg/lib/core.dart

Issue 9112012: Implement code generation for === and !==. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a bug and update status files. Created 8 years, 11 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 | « no previous file | frog/leg/resolver.dart » ('j') | frog/leg/ssa/nodes.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 void print(var obj) { 5 void print(var obj) {
6 // TODO(ngeoffray): enable when the parser accepts it. 6 // TODO(ngeoffray): enable when the parser accepts it.
7 // obj = obj.toString(); 7 // obj = obj.toString();
8 var hasConsole = JS("bool", @"typeof console == 'object'"); 8 var hasConsole = JS("bool", @"typeof console == 'object'");
9 if (hasConsole) { 9 if (hasConsole) {
10 JS("void", @"console.log($0)", obj); 10 JS("void", @"console.log($0)", obj);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 JS("bool", @"typeof $0 === 'number'", a) || 113 JS("bool", @"typeof $0 === 'number'", a) ||
114 JS("bool", @"typeof $0 === 'boolean'", a) || 114 JS("bool", @"typeof $0 === 'boolean'", a) ||
115 JS("bool", @"typeof $0 === 'string'", a)) { 115 JS("bool", @"typeof $0 === 'string'", a)) {
116 return JS("bool", @"$0 === $1", a, b); 116 return JS("bool", @"$0 === $1", a, b);
117 } 117 }
118 // TODO(kasperl): This is not the right implementation if the a has 118 // TODO(kasperl): This is not the right implementation if the a has
119 // a user-defined == operator. 119 // a user-defined == operator.
120 return JS("bool", @"$0 === $1", a, b); 120 return JS("bool", @"$0 === $1", a, b);
121 } 121 }
122 122
123 eqq(var a, var b) {
ngeoffray 2012/01/06 08:10:20 Why this method if HIdentity always ends up being
124 return JS("bool", @"$0 === $1", a, b);
125 }
126
123 gt(var a, var b) { 127 gt(var a, var b) {
124 if (checkNumbers(a, b, "num> expects a number as second operand.")) { 128 if (checkNumbers(a, b, "num> expects a number as second operand.")) {
125 return JS("bool", @"$0 > $1", a, b); 129 return JS("bool", @"$0 > $1", a, b);
126 } 130 }
127 throw "Unimplemented user-defined binary >."; 131 throw "Unimplemented user-defined binary >.";
128 } 132 }
129 133
130 ge(var a, var b) { 134 ge(var a, var b) {
131 if (checkNumbers(a, b, "num>= expects a number as second operand.")) { 135 if (checkNumbers(a, b, "num>= expects a number as second operand.")) {
132 return JS("bool", @"$0 >= $1", a, b); 136 return JS("bool", @"$0 >= $1", a, b);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } else { 332 } else {
329 return 333 return
330 JS("num", @"Math.floor($0 + (Date.now() - $1))", elapsedMs, startMs); 334 JS("num", @"Math.floor($0 + (Date.now() - $1))", elapsedMs, startMs);
331 } 335 }
332 } 336 }
333 337
334 int frequency() { 338 int frequency() {
335 return 1000; 339 return 1000;
336 } 340 }
337 } 341 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/resolver.dart » ('j') | frog/leg/ssa/nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698