Skip to content

Commit 382140c

Browse files
overlookmotelmarijnh
authored andcommitted
Consistent field order in Property
1 parent 7b38623 commit 382140c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

acorn/src/expression.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,9 +831,10 @@ pp.parseProperty = function(isPattern, refDestructuringErrors) {
831831
}
832832

833833
pp.parseGetterSetter = function(prop) {
834-
prop.kind = prop.key.name
834+
const kind = prop.key.name
835835
this.parsePropertyName(prop)
836836
prop.value = this.parseMethod(false)
837+
prop.kind = kind
837838
let paramCount = prop.kind === "get" ? 0 : 1
838839
if (prop.value.params.length !== paramCount) {
839840
let start = prop.value.start
@@ -856,9 +857,9 @@ pp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos
856857
prop.kind = "init"
857858
} else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
858859
if (isPattern) this.unexpected()
859-
prop.kind = "init"
860860
prop.method = true
861861
prop.value = this.parseMethod(isGenerator, isAsync)
862+
prop.kind = "init"
862863
} else if (!isPattern && !containsEsc &&
863864
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
864865
(prop.key.name === "get" || prop.key.name === "set") &&
@@ -870,7 +871,6 @@ pp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos
870871
this.checkUnreserved(prop.key)
871872
if (prop.key.name === "await" && !this.awaitIdentPos)
872873
this.awaitIdentPos = startPos
873-
prop.kind = "init"
874874
if (isPattern) {
875875
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key))
876876
} else if (this.type === tt.eq && refDestructuringErrors) {
@@ -880,6 +880,7 @@ pp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos
880880
} else {
881881
prop.value = this.copyNode(prop.key)
882882
}
883+
prop.kind = "init"
883884
prop.shorthand = true
884885
} else this.unexpected()
885886
}

0 commit comments

Comments
 (0)