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

add isStatic flag to method/property AST #43

Closed
chandu0101 opened this issue Oct 31, 2017 · 1 comment
Closed

add isStatic flag to method/property AST #43

chandu0101 opened this issue Oct 31, 2017 · 1 comment

Comments

@chandu0101
Copy link

chandu0101 commented Oct 31, 2017

Source :

 static new<T extends keyof DataTypes = keyof DataTypes>(
        value: number|boolean, dtype?: T) {
        const values = [value] as number[] | boolean[];
        return new Scalar({values: toTypedArray(values, dtype)}, dtype);
    }

    static ZERO = Scalar.new(0);
    static ONE = Scalar.new(1);
    static TWO = Scalar.new(2);
    static NEG_ONE = Scalar.new(-1);

    get(): number {
        return this.getValues()[0];
    }

parsed AST

  "properties": [
        {
          "name": "ZERO",
          "start": 15199,
          "end": 15227
        },
        {
          "name": "ONE",
          "start": 15232,
          "end": 15259
        },
        {
          "name": "TWO",
          "start": 15264,
          "end": 15291
        },
        {
          "name": "NEG_ONE",
          "start": 15296,
          "end": 15328
        }
      ],
      "methods": [
        {
          "name": "new",
          "isAbstract": false,
          "start": 14958,
          "end": 15193,
          "parameters": [
            {
              "name": "value",
              "type": "number|boolean",
              "start": 15023,
              "end": 15044
            },
            {
              "name": "dtype",
              "type": "T",
              "start": 15046,
              "end": 15055
            }
          ],
          "variables": [
            {
              "name": "values",
              "isConst": true,
              "isExported": false,
              "start": 15067,
              "end": 15114
            }
          ]
        },
        {
          "name": "get",
          "isAbstract": false,
          "type": "number",
          "start": 15334,
          "end": 15391,
          "parameters": [],
          "variables": []
        },
        {
          "name": "val",
          "isAbstract": false,
          "type": "Promise<number>",
          "start": 15397,
          "end": 15487,
          "parameters": [],
          "variables": []
        },
        {
          "name": "set",
          "isAbstract": false,
          "start": 15493,
          "end": 15556,
          "parameters": [
            {
              "name": "value",
              "type": "number",
              "start": 15497,
              "end": 15510
            }
          ],
          "variables": []
        },
....

new method is static but there is no way to assert the same in AST , same for properties ..

@chandu0101 chandu0101 changed the title add isStatic flag to method AST add isStatic flag to method/property AST Oct 31, 2017
@buehler
Copy link
Owner

buehler commented Aug 28, 2018

Closed by #91

@buehler buehler closed this as completed Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants