Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function missmatch if function name duplicated #344

Closed
jarlyyn opened this issue Dec 2, 2021 · 0 comments
Closed

function missmatch if function name duplicated #344

jarlyyn opened this issue Dec 2, 2021 · 0 comments
Labels

Comments

@jarlyyn
Copy link

jarlyyn commented Dec 2, 2021

package main

import (
	"fmt"

	"github.com/dop251/goja"
)

var js = `
function a(){}
function b(){ return "b" }
function c(){ return "c" }
function a(){}
`

func main() {
	vm := goja.New()
	_, err := vm.RunString(js)
	if err != nil {
		panic(err)
	}
	val, err := vm.RunString("b()")
	if err != nil {
		panic(err)
	}
	fmt.Println(val.String())

}

I think this code should panic or print string "b",but string "c" printed.

@dop251 dop251 closed this as completed in b5faa82 Dec 2, 2021
@dop251 dop251 added the bug label Dec 2, 2021
Gabri3l added a commit to mongodb-forks/goja that referenced this issue Jan 31, 2022
* Avoid calling iterator's return method again when it throws
* Fixed dynamic variable resolution when a parent lexical binding exists
* Support dereferencing in ExportTo(). Closes dop251#300
* Removed the mention of the es6 branch, updated the section about new features development.
* Destructuring assignments, rest and spread properties, default function parameters (dop251#303)
* Fixed argument variable reference resolution in stashless functions
* Fixed binding order for global function declarations when there are duplicate names. Fixes dop251#344.
* Make sure variables dynamically bound in parameter scope conflict with parameter bindings. See dop251#305.
* Fixed setting the stack pointer in enterFuncBody. Fixes dop251#309
* Support for assignment patterns in for-in and for-of loops. Support for spread elements in call arguments. Fixed various issues related to destructuring assignments. See dop251#305.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants