lexical this
This commit is contained in:
8
mcode.cm
8
mcode.cm
@@ -2767,6 +2767,7 @@ var mcode = function(ast) {
|
||||
var result = null
|
||||
var saved_label = 0
|
||||
var saved_func = 0
|
||||
var captured_this = 0
|
||||
|
||||
push(parent_states, saved)
|
||||
|
||||
@@ -2818,6 +2819,13 @@ var mcode = function(ast) {
|
||||
s_max_slot = s_next_temp_slot
|
||||
}
|
||||
|
||||
// Arrow functions capture the enclosing this via closure
|
||||
if (is_arrow) {
|
||||
captured_this = alloc_slot()
|
||||
emit_3("get", captured_this, saved.this_slot, 1)
|
||||
s_this_slot = captured_this
|
||||
}
|
||||
|
||||
// Default parameter initialization
|
||||
ps = 1
|
||||
_i = 0
|
||||
|
||||
Reference in New Issue
Block a user