Apply location data fix to decorators plugin (#699)
This commit is contained in:
parent
8f2f250144
commit
acf0e65090
@ -199,9 +199,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
];
|
||||
if (decorators.length) {
|
||||
node.decorators = decorators;
|
||||
if (this.hasPlugin("decorators2")) {
|
||||
this.resetStartLocationFromNode(node, decorators[0]);
|
||||
}
|
||||
this.state.decoratorStack[this.state.decoratorStack.length - 1] = [];
|
||||
}
|
||||
}
|
||||
@ -891,9 +889,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
// steal the decorators if there are any
|
||||
if (decorators.length) {
|
||||
member.decorators = decorators;
|
||||
if (this.hasPlugin("decorators2")) {
|
||||
this.resetStartLocationFromNode(member, decorators[0]);
|
||||
}
|
||||
decorators = [];
|
||||
}
|
||||
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 12,
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 5,
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start": 24,
|
||||
"start": 14,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
|
||||
@ -77,11 +77,11 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start": 27,
|
||||
"start": 14,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
|
||||
@ -44,12 +44,12 @@
|
||||
},
|
||||
"declaration": {
|
||||
"type": "ClassDeclaration",
|
||||
"start": 20,
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
|
||||
@ -44,12 +44,12 @@
|
||||
},
|
||||
"declaration": {
|
||||
"type": "ClassDeclaration",
|
||||
"start": 32,
|
||||
"start": 0,
|
||||
"end": 109,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "You can't attach decorators to a class constructor (3:2)"
|
||||
"throws": "You can't attach decorators to a class constructor (2:2)"
|
||||
}
|
||||
|
||||
@ -30,12 +30,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 5,
|
||||
"start": 0,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -76,12 +76,12 @@
|
||||
},
|
||||
"init": {
|
||||
"type": "ClassExpression",
|
||||
"start": 15,
|
||||
"start": 10,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start": 17,
|
||||
"start": 12,
|
||||
"end": 25,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start": 17,
|
||||
"start": 12,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start": 17,
|
||||
"start": 12,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start": 22,
|
||||
"start": 12,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -30,12 +30,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 31,
|
||||
"start": 0,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -30,12 +30,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 5,
|
||||
"start": 0,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
@ -95,12 +95,12 @@
|
||||
},
|
||||
"superClass": {
|
||||
"type": "ClassExpression",
|
||||
"start": 28,
|
||||
"start": 23,
|
||||
"end": 40,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
"column": 23
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start": 17,
|
||||
"start": 12,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start": 17,
|
||||
"start": 12,
|
||||
"end": 36,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 25,
|
||||
"start": 0,
|
||||
"end": 37,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user