Skip to content

Commit

Permalink
Minor object-rest-spread plugin cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Aug 29, 2017
1 parent 8365698 commit b9f58cc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/acorn-ext/object-rest-spread.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// An adapted and less strict version of the object rest spread acorn plugin.
// A less strict version of the object rest spread acorn plugin.
// Copyright Victor Homyakov. Released under MIT license:
// https://github.com/victor-homyakov/acorn-object-rest-spread

Expand All @@ -14,12 +14,11 @@ function enable(parser) {
}

function parseObj(func, args) {
let first = true
const [isPattern, refDestructuringErrors] = args
const node = this.startNode()
const propHash = Object.create(null)

let first = true

node.properties = []

this.next()
Expand Down Expand Up @@ -51,12 +50,11 @@ function parseObj(func, args) {
// https://github.com/babel/babylon/blob/master/src/parser/expression.js
if (this.type === tt.ellipsis) {
propNode = this.parseSpread(refDestructuringErrors)
propNode.type = "SpreadElement"

if (isPattern) {
propNode.type = "RestElement"
propNode.value = this.toAssignable(propNode.argument, true)
} else {
propNode.type = "SpreadElement"
}

node.properties.push(propNode)
Expand Down

0 comments on commit b9f58cc

Please sign in to comment.