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

Unified Diff: frog/corejs.dart

Issue 9447049: Put two $ in front of top-level builtins, to not clash with member names. Otherwise, the global obj… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/tests/client/dom/WindowEqTest.dart ('k') | frog/member.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/corejs.dart
===================================================================
--- frog/corejs.dart (revision 4562)
+++ frog/corejs.dart (working copy)
@@ -214,14 +214,14 @@
/** Snippet for `$ne`. */
final String _NE_FUNCTION = @"""
-function $ne(x, y) {
+function $$ne(x, y) {
if (x == null) return y != null;
return (typeof(x) != 'object') ? x !== y : !x.$eq(y);
}""";
/** Snippet for `$eq`. */
final String _EQ_FUNCTION = @"""
-function $eq(x, y) {
+function $$eq(x, y) {
if (x == null) return y == null;
return (typeof(x) != 'object') ? x === y : x.$eq(y);
}
@@ -232,7 +232,7 @@
/** Snippet for `$bit_not`. */
final String _BIT_NOT_FUNCTION = @"""
-function $bit_not(x) {
+function $$bit_not(x) {
if (typeof(x) == 'number') return ~x;
if (typeof(x) == 'object') return x.$bit_not();
$throw(new NoSuchMethodException(x, "operator ~", []));
@@ -240,7 +240,7 @@
/** Snippet for `$negate`. */
final String _NEGATE_FUNCTION = @"""
-function $negate(x) {
+function $$negate(x) {
if (typeof(x) == 'number') return -x;
if (typeof(x) == 'object') return x.$negate();
$throw(new NoSuchMethodException(x, "operator negate", []));
@@ -248,7 +248,7 @@
/** Snippet for `$add`. This relies on JS's string "+" to match Dart's. */
final String _ADD_FUNCTION = @"""
-function $add$complex(x, y) {
+function $$add$complex(x, y) {
if (typeof(x) == 'number') {
$throw(new IllegalArgumentException(y));
} else if (typeof(x) == 'string') {
@@ -265,14 +265,14 @@
}
}
-function $add(x, y) {
+function $$add(x, y) {
if (typeof(x) == 'number' && typeof(y) == 'number') return x + y;
- return $add$complex(x, y);
+ return $$add$complex(x, y);
}""";
/** Snippet for `$truncdiv`. This uses `$throw`. */
final String _TRUNCDIV_FUNCTION = @"""
-function $truncdiv(x, y) {
+function $$truncdiv(x, y) {
if (typeof(x) == 'number') {
if (typeof(y) == 'number') {
if (y == 0) $throw(new IntegerDivisionByZeroException());
@@ -290,7 +290,7 @@
/** Snippet for `$mod`. */
final String _MOD_FUNCTION = @"""
-function $mod(x, y) {
+function $$mod(x, y) {
if (typeof(x) == 'number') {
if (typeof(y) == 'number') {
var result = x % y;
@@ -317,7 +317,7 @@
/** Code snippet for all other operators. */
String _otherOperator(String jsname, String op) {
return """
-function $jsname\$complex(x, y) {
+function \$$jsname\$complex(x, y) {
if (typeof(x) == 'number') {
\$throw(new IllegalArgumentException(y));
} else if (typeof(x) == 'object') {
@@ -326,9 +326,9 @@
\$throw(new NoSuchMethodException(x, "operator $op", [y]));
}
}
-function $jsname(x, y) {
+function \$$jsname(x, y) {
if (typeof(x) == 'number' && typeof(y) == 'number') return x $op y;
- return $jsname\$complex(x, y);
+ return \$$jsname\$complex(x, y);
}""";
}
« no previous file with comments | « client/tests/client/dom/WindowEqTest.dart ('k') | frog/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698