on master help sign in
javascript: fix names
5e84e36raichoo
src/IRTS/CodegenJavaScript.hs+6−6
@@ -118,10 +118,10 @@ translateIdentifier =
118 , "yield"
118 , "yield"
119 ]
119 ]
120
120
121−translateNamespace :: Name -> [String]
121+translateNamespace :: Name -> String
122−translateNamespace (UN _) = [idrNamespace]
122+translateNamespace (UN _) = idrNamespace
123−translateNamespace (NS _ ns) = idrNamespace : map translateIdentifier ns
123+translateNamespace (NS _ ns) = idrNamespace ++ concatMap translateIdentifier ns
124−translateNamespace (MN _ _) = [idrNamespace]
124+translateNamespace (MN _ _) = idrNamespace
125
125
126translateName :: Name -> String
126translateName :: Name -> String
127translateName (UN name) = translateIdentifier name
127translateName (UN name) = translateIdentifier name
@@ -150,7 +150,7 @@ translateParameterlist =
150
150
151translateDeclaration :: (String, SDecl) -> String
151translateDeclaration :: (String, SDecl) -> String
152translateDeclaration (path, SFun name params stackSize body) =
152translateDeclaration (path, SFun name params stackSize body) =
153− "var " ++ concat (path ++ [translateName name])
153+ "var " ++ path ++ translateName name
154 ++ " = function("
154 ++ " = function("
155 ++ intercalate "," p
155 ++ intercalate "," p
156 ++ "){\n"
156 ++ "){\n"
@@ -509,7 +509,7 @@ createTailcall call =
509 idrRTNamespace ++ "tailcall(function(){return " ++ call ++ "})"
509 idrRTNamespace ++ "tailcall(function(){return " ++ call ++ "})"
510
510
511translateFunctionCall name vars =
511translateFunctionCall name vars =
512− concat (translateNamespace name)
512+ translateNamespace name
513 ++ translateName name
513 ++ translateName name
514 ++ "("
514 ++ "("
515 ++ intercalate "," (map translateVariableName vars)
515 ++ intercalate "," (map translateVariableName vars)