Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

ask does not print debug info precisely #52

Description

@Astrapolis-peasant

having this example code
···
import { PackedStorableArray} from "ask-lang";

@contract
class Flipper {
@State flag: bool;

@state
@packed({ "capacity": 128 })
packeArr: PackedStorableArray<UInt128> = new PackedStorableArray<UInt128>();

@state
aArr: PackedStorableArray<UInt128> = new PackedStorableArray<UInt128>();

constructor() {
}

@constructor
default(initFlag: bool): void {
    this.flag = initFlag;
}

@message
flip(): void {
    const v = this.flag;
    this.flag = !v;
}

@message({"mutates": false})
get(): bool {
    return this.flag;
}

}
···
Since we do not import UInt128, this code will not compile.

However, in debug

FAILURE TypeError: Cannot read property 'kind' of null
    at NamedTypeNodeDef.getTypeKind (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/typedef.js:206:21)
    at new NamedTypeNodeDef (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/typedef.js:58:32)
    at FieldDef.resolveField (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/elementdef.js:92:25)
    at new FieldDef (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/elementdef.js:82:15)
    at /home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/classdef.js:52:39
    at Map.forEach (<anonymous>)
    at ContractInterpreter.ClassInterpreter.resolveFieldMembers (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/classdef.js:50:42)
    at ContractInterpreter.ClassInterpreter [as constructor] (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/classdef.js:44:15)
    at new ContractInterpreter (/home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/classdef.js:87:28)
    at /home/bonan/repos/ask/ask-cli-test/node_modules/ask-transform/dist/contract/contract.js:44:28

I think this is caused by 2 step transform as the way of compilation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions