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

Implement Async Arrow Function #16

Open
naijun0403 opened this issue Nov 1, 2023 · 0 comments
Open

Implement Async Arrow Function #16

naijun0403 opened this issue Nov 1, 2023 · 0 comments

Comments

@naijun0403
Copy link

naijun0403 commented Nov 1, 2023

Summary

Both async function and arrow function seem to work, but they don't work if you use them together.

Spec

VM: GraalVM 17.0.8
OS: macOS 14

Error

1:    const a = async () => {}
                      ^
2:    console.log(a)

SyntaxError: expected function, but found (

Example

const a = async () => {}
console.log(a)
import com.reevajs.reeva.Reeva
import com.reevajs.reeva.core.Agent
import com.reevajs.reeva.core.lifecycle.LiteralSourceInfo

fun main() {
    val agent = Agent.build()

    agent.enter()

    println(
        Reeva.execute(
            LiteralSourceInfo(
                "test",
                """
                    const a = async () => {}
                    console.log(a)
                """.trimIndent(),
                false
            ),
            agent.makeRealmAndInitializeExecutionEnvironment()
        )
    )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant