Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index 004f9bf61bcdd1a088f12696b7216c0ead17f1c6..fbe50c95a461f4f86f139074793a2dab9e23948d 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -19,6 +19,7 @@ |
var EQUALS; |
var STRICT_EQUALS; |
var COMPARE; |
+var COMPARE_STRONG; |
var ADD; |
var ADD_STRONG; |
var STRING_ADD_LEFT; |
@@ -203,6 +204,14 @@ COMPARE = function COMPARE(x, ncr) { |
} |
} |
+// Strong mode COMPARE throws if an implicit conversion would be performed |
+COMPARE_STRONG = function COMPARE_STRONG(x, ncr) { |
+ if (IS_STRING(this) && IS_STRING(x)) return %_StringCompare(this, x); |
+ if (IS_NUMBER(this) && IS_NUMBER(x)) return %NumberCompare(this, x, ncr); |
+ |
+ throw %MakeTypeError('strong_implicit_cast'); |
+} |
+ |
/* ----------------------------------- |