From c1c9e62ac7ffceb5d2bde175c5f3a9a43f298765 Mon Sep 17 00:00:00 2001 From: Kang Hyojun Date: Sun, 12 Nov 2017 18:29:54 +0900 Subject: [PATCH] Do not hard-code map type name --- src/Nirum/Targets/Python.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Nirum/Targets/Python.hs b/src/Nirum/Targets/Python.hs index de67547..9f0298a 100644 --- a/src/Nirum/Targets/Python.hs +++ b/src/Nirum/Targets/Python.hs @@ -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")]) ] @@ -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 @@ -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 $