Add test case for decorated static method

This commit is contained in:
Peeyush Kushwaha 2017-06-23 18:13:51 +05:30
parent 37fa77e84f
commit 2c8fc75643
2 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,4 @@
class Foo {
@dec
static bar() {}
}

View File

@ -0,0 +1,175 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"sourceType": "script",
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 6,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "Foo"
},
"name": "Foo"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 10,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 4,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 14,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 3,
"column": 17
}
},
"decorators": [
{
"type": "Decorator",
"start": 14,
"end": 18,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 6
}
},
"expression": {
"type": "Identifier",
"start": 15,
"end": 18,
"loc": {
"start": {
"line": 2,
"column": 3
},
"end": {
"line": 2,
"column": 6
},
"identifierName": "dec"
},
"name": "dec"
}
}
],
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 28,
"end": 31,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 12
},
"identifierName": "bar"
},
"name": "bar"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 34,
"end": 36,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 3,
"column": 17
}
},
"body": [],
"directives": []
}
}
]
}
}
],
"directives": []
}
}