Skip to content

Commit

Permalink
Do not hard-code map type name
Browse files Browse the repository at this point in the history
  • Loading branch information
kanghyojun committed Nov 12, 2017
1 parent 3ed1e13 commit c1c9e62
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Nirum/Targets/Python.hs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ compileTypeDeclaration
]
insertThirdPartyImportsA
[ ("nirum.constructs", [("name_dict_type", "NameDict")])
, ("nirum.datastructures", [(nirumMapName, "Map")])
, ("nirum.service", [("service_type", "Service")])
, ("nirum.transport", [("transport_type", "Transport")])
]
Expand Down Expand Up @@ -984,6 +985,8 @@ class {className}_Client($className):
{clientMethods'}
|]
where
nirumMapName :: T.Text
nirumMapName = "map_type"
className :: T.Text
className = toClassName' name'
commaNl :: [T.Text] -> T.Text
Expand Down Expand Up @@ -1094,7 +1097,7 @@ class {className}_Client($className):
toKeyItem :: I.Identifier -> T.Text -> T.Text
toKeyItem ident v = [qq|'{toAttributeName ident}': {v}|]
wrapMap :: T.Text -> T.Text
wrapMap items = [qq|map_type(\{$items\})|]
wrapMap items = [qq|$nirumMapName(\{$items\})|]
compileAnnotation :: I.Identifier -> A.AnnotationArgumentSet -> T.Text
compileAnnotation ident annoArgument =
toKeyItem ident $
Expand Down

0 comments on commit c1c9e62

Please sign in to comment.