- The visitor keys for `ObjectTypeAnnotation`s were incorrect so those nodes weren't being traversed so comments weren't attached for them.
 - The type parser wasn't eating the semicolons for the nodes so the `end` location of each of the type properties wasn't accurate which threw off the code generation newline algorithm.
 - Type properties hadn't been given the `UserWhitespacable` alias.
This commit is contained in:
Sebastian McKenzie 2015-03-29 16:44:36 +11:00
parent aeb0cfcbbe
commit 54fa079bf4

View File

@ -215,6 +215,7 @@ pp.flow_parseObjectTypeIndexer = function (node, isStatic) {
this.expect(tt.colon)
node.value = this.flow_parseType()
this.flow_objectTypeSemicolon()
return this.finishNode(node, "ObjectTypeIndexer")
}
@ -251,6 +252,7 @@ pp.flow_parseObjectTypeMethod = function (start, isStatic, key) {
node.static = isStatic
node.key = key
node.optional = false
this.flow_objectTypeSemicolon()
return this.finishNode(node, "ObjectTypeProperty")
}
@ -258,6 +260,7 @@ pp.flow_parseObjectTypeCallProperty = function (node, isStatic) {
var valueNode = this.startNode()
node.static = isStatic
node.value = this.flow_parseObjectTypeMethodish(valueNode)
this.flow_objectTypeSemicolon()
return this.finishNode(node, "ObjectTypeCallProperty")
}
@ -307,13 +310,10 @@ pp.flow_parseObjectType = function (allowStatic) {
node.value = this.flow_parseType()
node.optional = optional
node.static = isStatic
this.flow_objectTypeSemicolon()
nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty"))
}
}
if (!this.eat(tt.semi) && this.type !== tt.braceR) {
this.unexpected()
}
}
this.expect(tt.braceR)
@ -321,6 +321,12 @@ pp.flow_parseObjectType = function (allowStatic) {
return this.finishNode(nodeStart, "ObjectTypeAnnotation")
}
pp.flow_objectTypeSemicolon = function () {
if (!this.eat(tt.semi) && this.type !== tt.braceR) {
this.unexpected()
}
}
pp.flow_parseGenericType = function (start, id) {
var node = this.startNodeAt(start)