summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-10-02 20:34:22 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-10-02 20:34:22 +0100
commitecdd70336d64b21f57313c9c9e55e5f00f48f576 (patch)
tree78b24c35df25f7edaeba2f0750758207a69f428c /src
parentde5907061aead26aeef95d998a02ea7b00d4242d (diff)
downloadnsgenbind-master.tar.gz
nsgenbind-master.tar.bz2
typeck: When checking BOOL permit numbers because they have coercion rulesHEADmaster
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'src')
-rw-r--r--src/duk-libdom-interface.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/duk-libdom-interface.c b/src/duk-libdom-interface.c
index 7926478..46436c4 100644
--- a/src/duk-libdom-interface.c
+++ b/src/duk-libdom-interface.c
@@ -1230,9 +1230,13 @@ output_operation_argument_type_check(
case WEBIDL_TYPE_BOOL:
outputf(outc,
- "\t\tif (!duk_is_boolean(ctx, %d)) {\n"
- "\t\t\treturn duk_error(ctx, DUK_ERR_ERROR, %s_error_fmt_bool_type, %d, \"%s\");\n"
- "\t\t}\n", argidx, DLPFX, argidx, argumente->name);
+ "\t\tif (!duk_is_boolean(ctx, %d)) {\n"
+ "\t\t\tif (duk_is_number(ctx, %d)) {\n"
+ "\t\t\t\tduk_to_boolean(ctx, %d);\n"
+ "\t\t\t} else {\n"
+ "\t\t\t\treturn duk_error(ctx, DUK_ERR_ERROR, %s_error_fmt_bool_type, %d, \"%s\");\n"
+ "\t\t\t}\n"
+ "\t\t}\n", argidx, argidx, argidx, DLPFX, argidx, argumente->name);
break;
case WEBIDL_TYPE_FLOAT: