aboutsummaryrefslogtreecommitdiff
path: root/src/embind/embind.js
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-05-09 12:39:22 -0700
committerChad Austin <chad@imvu.com>2013-05-17 12:58:29 -0700
commit17ab8d9f57f0cb31d2d83555ae898b32b99600f8 (patch)
tree9962bf393588bc1a45cb71938ae0a5bfc5c6b8a0 /src/embind/embind.js
parent0074368080bee713232e0b152dc0cae790ec34d3 (diff)
Allow implicit conversion from booleans to ints/floats (for WebGL)
Diffstat (limited to 'src/embind/embind.js')
-rw-r--r--src/embind/embind.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index ff402885..91386c69 100644
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -311,7 +311,7 @@ function __embind_register_integer(primitiveType, name, minRange, maxRange) {
'toWireType': function(destructors, value) {
// todo: Here we have an opportunity for -O3 level "unsafe" optimizations: we could
// avoid the following two if()s and assume value is of proper type.
- if (typeof value !== "number") {
+ if (typeof value !== "number" && typeof value !== "boolean") {
throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + this.name);
}
if (value < minRange || value > maxRange) {
@@ -333,8 +333,8 @@ function __embind_register_float(rawType, name) {
'toWireType': function(destructors, value) {
// todo: Here we have an opportunity for -O3 level "unsafe" optimizations: we could
// avoid the following if() and assume value is of proper type.
- if (typeof value !== "number") {
- throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' +this.name);
+ if (typeof value !== "number" && typeof value !== "boolean") {
+ throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + this.name);
}
return value;
},