Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Added flow annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
  • Loading branch information
Juanjo Alvarez authored and dennwc committed Aug 8, 2018
1 parent edbbb75 commit ececb1e
Show file tree
Hide file tree
Showing 5 changed files with 2,976 additions and 0 deletions.
14 changes: 14 additions & 0 deletions driver/normalizer/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,18 @@ var Annotations = []Mapping{
},
role.Statement, role.Incomplete,
),

// flow type annotations
AnnotateType("TypeAnnotation", nil, role.Declaration, role.Type),
AnnotateType("GenericTypeAnnotation", nil, role.Declaration, role.Type),
AnnotateType("MixedTypeAnnotation", nil, role.Declaration, role.Type),
AnnotateType("NumberTypeAnnotation", nil, role.Declaration, role.Type, role.Number),
AnnotateType("BooleanTypeAnnotation", nil, role.Declaration, role.Type, role.Boolean),
AnnotateType("StringTypeAnnotation", nil, role.Declaration, role.Type, role.String),
AnnotateType("StringLiteralTypeAnnotation", nil, role.Declaration, role.Type, role.String, role.Literal),
AnnotateType("NullLiteralTypeAnnotation", nil, role.Declaration, role.Type, role.Null),
AnnotateType("UnionTypeAnnotation", nil, role.Declaration, role.Type, role.Incomplete),
AnnotateType("VoidTypeAnnotation", nil, role.Declaration, role.Type, role.Incomplete),
AnnotateType("AnyTypeAnnotation", nil, role.Declaration, role.Type, role.Incomplete),
AnnotateType("NullableTypeAnnotation", nil, role.Declaration, role.Type, role.Incomplete),
}
11 changes: 11 additions & 0 deletions fixtures/flow-annotations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @flow

export default class PluginPass {
testfnc1(a: string, b: ?string, c: number, d: mixed, e: Object){}
testfnc2(f: string | boolean, g: boolean, h: null, i: void){}
testfncd(j: "one" | "other"){}

num: number = 1;
s: string = "foo";
pok: File;
}
Loading

0 comments on commit ececb1e

Please sign in to comment.