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

Commit

Permalink
sem: don't map FunctionDeclaration>[predicate returnType typeParameters]
Browse files Browse the repository at this point in the history
Skip mapping Flow type annotation for function's
 - arguments
 - return types

in Sematic UAST

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
  • Loading branch information
bzz committed Mar 2, 2019
1 parent c20f8d5 commit ec04b0c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions driver/normalizer/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,18 @@ var Normalizers = []Mapping{
},
)),
MapSemantic("FunctionDeclaration", uast.FunctionGroup{}, MapObj(
Obj{
"id": Var("name"),
"generator": Var("gen"), // FIXME: define channels in SDK? or return a function?
"async": Var("async"), // TODO: async
"body": Var("body"),
"params": Each("params", Cases("param_case",
Fields{
{Name: "id", Op: Var("name")},
{Name: "generator", Op: Var("gen")}, // FIXME: define channels in SDK? or return a function?
{Name: "async", Op: Var("async")}, // TODO: async
{Name: "body", Op: Var("body")},
//FIXME(bzz): map predicate properly
{Name: "predicate", Drop: true, Op: Any()},
//FIXME(bzz): map Flow return type annotations
{Name: "returnType", Drop: true, Op: Any()},
//FIXME(bzz): map Flow argument type annotations
{Name: "typeParameters", Drop: true, Op: Any()},
{Name: "params", Op: Each("params", Cases("param_case",
// Identifier
Check(
HasType(uast.Identifier{}),
Expand All @@ -276,7 +282,7 @@ var Normalizers = []Mapping{
uast.KeyPos: Var("arg_pos"),
"argument": Var("arg_name"),
},
)),
))},
},
Obj{
"Nodes": Arr(
Expand Down

0 comments on commit ec04b0c

Please sign in to comment.