Skip to content

Commit

Permalink
allow keyword in Flow object declaration property names with type par…
Browse files Browse the repository at this point in the history
…ameters (babel#146)
  • Loading branch information
danharper authored and Kristof degrave committed Oct 27, 2016
1 parent fadcc84 commit 8b7c5ca
Show file tree
Hide file tree
Showing 13 changed files with 2,427 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ pp.flowParseObjectTypeCallProperty = function (node, isStatic) {
};

pp.flowParseObjectType = function (allowStatic, allowExact) {
const oldInType = this.state.inType;
this.state.inType = true;

let nodeStart = this.startNode();
let node;
let propertyKey;
Expand Down Expand Up @@ -399,7 +402,11 @@ pp.flowParseObjectType = function (allowStatic, allowExact) {

this.expect(endDelim);

return this.finishNode(nodeStart, "ObjectTypeAnnotation");
const out = this.finishNode(nodeStart, "ObjectTypeAnnotation");

this.state.inType = oldInType;

return out;
};

pp.flowObjectTypeSemicolon = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare class X {
foobar<T>(): void;
delete<T>(): void;
yield<T>(): void;
do<T>(): void;
static foobar<T>(): void;
static delete<T>(): void;
static yield<T>(): void;
static do<T>(): void;
};
Loading

0 comments on commit 8b7c5ca

Please sign in to comment.