diff --git a/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver-inlined.js b/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver-inlined.js index 4b7319679..35354a487 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver-inlined.js +++ b/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver-inlined.js @@ -4,8 +4,8 @@ class_addMethods(the_class,[new objj_method(sel_getUid("mySelector"),function $M (_1.isa.method_msgSend["init"]||_objj_forward)(_1,"init"); _1=nil; (_1==null?_1:(_1.isa.method_msgSend["init"]||_objj_forward)(_1,"init")); -},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(_3,_4){ -(_3.isa.method_msgSend["init"]||_objj_forward)(_3,"init"); +},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(self,_cmd){ +(self.isa.method_msgSend["init"]||_objj_forward)(self,"init"); eval("self = null;"); -(_3==null?_3:(_3.isa.method_msgSend["init"]||_objj_forward)(_3,"init")); +(self==null?self:(self.isa.method_msgSend["init"]||_objj_forward)(self,"init")); },["id"])]); \ No newline at end of file diff --git a/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver.js b/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver.js index 440812342..ebed7b793 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver.js +++ b/Tests/Objective-J/Preprocessor/OutputTests/Messages/self-as-receiver.js @@ -4,8 +4,8 @@ class_addMethods(the_class,[new objj_method(sel_getUid("mySelector"),function $M _1.isa.objj_msgSend0(_1,"init"); _1=nil; (_1==null?_1:_1.isa.objj_msgSend0(_1,"init")); -},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(_3,_4){ -_3.isa.objj_msgSend0(_3,"init"); +},["id"]),new objj_method(sel_getUid("mySelector2"),function $MyClass__mySelector2(self,_cmd){ +self.isa.objj_msgSend0(self,"init"); eval("self = null;"); -(_3==null?_3:_3.isa.objj_msgSend0(_3,"init")); +(self==null?self:self.isa.objj_msgSend0(self,"init")); },["id"])]); \ No newline at end of file diff --git a/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j index d94fa2450..b7f7c7aaf 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j +++ b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j @@ -5,7 +5,7 @@ - (id)a { - @ref(_control); + var x = @ref(_control); } @end diff --git a/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js index b73f3c35f..c9fe604ea 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js +++ b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js @@ -2,7 +2,7 @@ meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_control","id")]);objj_registerClassPair(the_class); class_addMethods(the_class, [new objj_method(sel_getUid("a"), function $TC__a(self, _cmd) { - function(__input) { if (arguments.length) return self._control = __input; return self._control; }; + var x = function(__input) { if (arguments.length) return self._control = __input; return self._control; }; } ,["id"])]); diff --git a/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j b/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j index cd5164d6a..14efc8e2a 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j +++ b/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j @@ -32,7 +32,8 @@ var FILENAMES = [ } async function compressor(srcCode) { - return (await terser.minify(srcCode)).code; + var m = await terser.minify(srcCode, { keep_fnames: false, mangle: { properties: true }, toplevel: true }); + return m.code; } + (void)initialize @@ -59,12 +60,12 @@ async function compressor(srcCode) { correctInlined = fs.existsSync(p) ? fs.readFileSync(p, {encoding: "utf8"}) : correct; // Get inlined version if it exists. Otherwise use the regular one. await [self assertNoThrow: async function() { - preprocessed = ObjectiveJ.ObjJCompiler.compileToExecutable(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: false, transformNamedFunctionDeclarationToAssignment: true}).code(); + preprocessed = ObjectiveJ.ObjJCompiler.compile(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: false, transformNamedFunctionDeclarationToAssignment: true}).jsBuffer.toString(); preprocessed = await compressor(preprocessed); correct = await compressor(correct); // Get an Inlined version - preprocessedInlined = ObjectiveJ.ObjJCompiler.compileToExecutable(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: true, transformNamedFunctionDeclarationToAssignment:true}).code(); + preprocessedInlined = ObjectiveJ.ObjJCompiler.compile(unpreprocessed, nil, {includeMethodFunctionNames: true, includeMethodArgumentTypeSignatures: true, includeIvarTypeSignatures: true, inlineMsgSendFunctions: true, transformNamedFunctionDeclarationToAssignment: true}).jsBuffer.toString(); preprocessedInlined = await compressor(preprocessedInlined); correctInlined = await compressor(correctInlined); }];