ratel-rust / ratel-core

High performance JavaScript to JavaScript compiler with a Rust core
Apache License 2.0
432 stars 17 forks source link

[WIP] Support keyword async #129

Open LuoZijun opened 5 years ago

LuoZijun commented 5 years ago

Resolve issue: #109

Should pass:


// https://www.ecma-international.org/ecma-262/9.0/index.html#sec-async-function-definitions
async function foo0(){ }

// https://www.ecma-international.org/ecma-262/9.0/index.html#sec-async-generator-function-definitions
async function* foo1(){ }

// https://www.ecma-international.org/ecma-262/9.0/index.html#prod-MethodDefinition
// https://www.ecma-international.org/ecma-262/9.0/index.html#prod-AsyncMethod
class Cls {
    async foo() { }
    static async foo1() { }
}
// https://www.ecma-international.org/ecma-262/9.0/index.html#prod-AsyncGeneratorMethod
class Cls {
    async* foo() { }
    static async* foo1() { }
}

// https://www.ecma-international.org/ecma-262/9.0/index.html#sec-async-arrow-function-definitions
async a => {};
async a => a
async (a, b) => {}
async (a, b) => a