Skip to content

Commit

Permalink
Fixed argument variable reference resolution in stashless functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dop251 committed Aug 17, 2021
1 parent acd0507 commit 07a7fd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4113,6 +4113,17 @@ func TestArrowUseStrict(t *testing.T) {
}
}

func TestParameterOverride(t *testing.T) {
const SCRIPT = `
function f(arg) {
var arg = arg || "default"
return arg
}
f()
`
testScript1(SCRIPT, asciiString("default"), t)
}

/*
func TestBabel(t *testing.T) {
src, err := ioutil.ReadFile("babel7.js")
Expand Down
2 changes: 1 addition & 1 deletion vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ func (r *resolveMixedStack) exec(vm *vm) {
if r.idx > 0 {
idx = vm.sb + vm.args + r.idx
} else {
idx = vm.sb + r.idx
idx = vm.sb - r.idx
}

ref = newStashRef(r.typ, r.name, (*[]Value)(&vm.stack), idx)
Expand Down

0 comments on commit 07a7fd9

Please sign in to comment.