Skip to content

ERROR TS2391: Function implementation is missing or not immediately following the declaration. #160

Closed
@LiaoPeng

Description

@LiaoPeng

The code:

import "allocator/arena";

interface Car{
	getBrand():string;
}

export class Audi implements Car{
	getBrand():string{
		return "audi";
	}
}
let audi = new Audi();

When I compile using asc, it throw exception:

ERROR TS2391: Function implementation is missing or not immediately following the declaration.

 	getBrand():string;
             ~~~~~~
 in test_impl.ts(5,12)

ERROR: Parse error
    at Object.main (/Users/Peng/GitHub/assemblyscript/cli/asc.js:377:23)
    at Object.<anonymous> (/Users/Peng/GitHub/assemblyscript/bin/asc:3:60)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
    at startup (internal/bootstrap/node.js:228:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:575:3)

If I change the getBrand():string; to getBrand():string{};, it compiles fine.
It looks FunctionPrototype not finished.

/** A yet unresolved function prototype. */
export class FunctionPrototype extends Element {

I want to contribute some code, what shall I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions