cs-au-dk / jalangi2

Dynamic analysis framework for JavaScript
Apache License 2.0
1 stars 1 forks source link

Strict mode not ok yet in the tracifier branch #2

Open algobardo opened 7 years ago

algobardo commented 7 years ago

Some of the changes in the tracifier branch cannot be applied. Tajs test this code for strict mode

(function(){
   'use strict';
   try { 
     function f(){TAJS_assertEquals(undefined, this)};
     f();
   } catch (e) { 
     TAJS_assert(false);
   }
})();

which generates

                           ....
                            f = J$.N(169, 'f', J$.T(161, f, 12, false, 65), 0);
                           ....
                            try {
                                var f = function f() {
                                    'use strict';
                                     ....

Now, note that at the T invocation f is not initialised yet: f = undefined, because f is not hoisted since it is no longer a function declaration. So when the strict mode is set to f in T, a TypeError is thrown.

algobardo commented 7 years ago

@christofferqa any quick idea ?