]> git.kaiwu.me - njs.git/commitdiff
Fixed import segfault.
authorhongzhidao <hongzhidao@gmail.com>
Fri, 13 Dec 2019 04:47:37 +0000 (12:47 +0800)
committerhongzhidao <hongzhidao@gmail.com>
Fri, 13 Dec 2019 04:47:37 +0000 (12:47 +0800)
This closes #274 issue on Github.

src/njs_module.c
test/module/lib1.js

index 61a2bb6573612312f703edad0f6c76b5f194388c..b0aa04827af15166abf732f0d1e59587f654d5d1 100644 (file)
@@ -175,6 +175,7 @@ njs_parser_module(njs_vm_t *vm, njs_parser_t *parser)
         goto fail;
     }
 
+    module->function.args_offset = 1;
     module->function.u.lambda = parser->node->u.value.data.u.lambda;
 
     njs_mp_free(vm->mem_pool, text.start);
index 5bfe2d0d8204e072a2672c572cd121b18e4b7105..f2909605ce7b535277e3edede335fc6cd07ab7e9 100644 (file)
@@ -1,3 +1,9 @@
+var foo = (function(){
+    return (function f() {})
+});
+
+foo()({1:[]})
+
 function hash() {
     var h = crypto.createHash('md5');
     var v = h.update('AB').digest('hex');