on master help sign in
javascript: remove old namespaces
commite4d23ecedade4f52f7d2b527fb52176996febb2a authorraichoo <raichoo@googlemail.com> dateSat 28 Jun 2014, 02:08 (12 years ago) parentc82427b
2 files changed+14−20
jsrts/jsbn/jsbn.js+3−3 src/IRTS/CodegenJavaScript.hs+11−17
jsrts/jsbn/jsbn.js+3−3
@@ -1,4 +1,4 @@
1−var __IDRRT__bigInt = (function() {
1+var i$bigInt = (function() {
22// Copyright (c) 2005 Tom Wu
33// All Rights Reserved.
44// See "LICENSE" for details.
@@ -1234,5 +1234,5 @@ return function(val) {
12341234}
12351235})();
12361236
1237−var __IDRRT__ZERO = __IDRRT__bigInt("0");
1238−var __IDRRT__ONE = __IDRRT__bigInt("1");
1237+var i$ZERO = i$bigInt("0");
1238+var i$ONE = i$bigInt("1");
src/IRTS/CodegenJavaScript.hs+11−17
@@ -24,12 +24,6 @@ import System.IO
2424import System.Directory
2525
2626
27−idrNamespace :: String
28−idrNamespace = "__IDR__"
29−idrRTNamespace = "__IDRRT__"
30−idrLTNamespace = "__IDRLT__"
31−idrCTRNamespace = "__IDRCTR__"
32−
3327data CompileInfo = CompileInfo { compileInfoApplyCases :: [Int]
3428 , compileInfoEvalCases :: [Int]
3529 , compileInfoNeedsBigInt :: Bool
@@ -214,13 +208,13 @@ compileJS' indent (JSFunction args body) =
214208 ++ "\n}\n"
215209
216210compileJS' indent (JSType ty)
217− | JSIntTy <- ty = idrRTNamespace ++ "Int"
218− | JSStringTy <- ty = idrRTNamespace ++ "String"
219− | JSIntegerTy <- ty = idrRTNamespace ++ "Integer"
220− | JSFloatTy <- ty = idrRTNamespace ++ "Float"
221− | JSCharTy <- ty = idrRTNamespace ++ "Char"
222− | JSPtrTy <- ty = idrRTNamespace ++ "Ptr"
223− | JSForgotTy <- ty = idrRTNamespace ++ "Forgot"
211+ | JSIntTy <- ty = "i$Int"
212+ | JSStringTy <- ty = "i$String"
213+ | JSIntegerTy <- ty = "i$Integer"
214+ | JSFloatTy <- ty = "i$Float"
215+ | JSCharTy <- ty = "i$Char"
216+ | JSPtrTy <- ty = "i$Ptr"
217+ | JSForgotTy <- ty = "i$Forgot"
224218
225219compileJS' indent (JSSeq seq) =
226220 intercalate ";\n" (
@@ -284,10 +278,10 @@ compileJS' indent (JSString str) =
284278compileJS' indent (JSNum num)
285279 | JSInt i <- num = show i
286280 | JSFloat f <- num = show f
287− | JSInteger JSBigZero <- num = "__IDRRT__ZERO"
288− | JSInteger JSBigOne <- num = "__IDRRT__ONE"
281+ | JSInteger JSBigZero <- num = "i$ZERO"
282+ | JSInteger JSBigOne <- num = "i$ONE"
289283 | JSInteger (JSBigInt i) <- num = show i
290− | JSInteger (JSBigIntExpr e) <- num = "__IDRRT__bigInt(" ++ compileJS' indent e ++ ")"
284+ | JSInteger (JSBigIntExpr e) <- num = "i$bigInt(" ++ compileJS' indent e ++ ")"
291285
292286compileJS' indent (JSAssign lhs rhs) =
293287 compileJS' indent lhs ++ " = " ++ compileJS' indent rhs
@@ -361,7 +355,7 @@ compileJS' indent (JSWord word)
361355 | JSWord8 b <- word = "new Uint8Array([" ++ show b ++ "])"
362356 | JSWord16 b <- word = "new Uint16Array([" ++ show b ++ "])"
363357 | JSWord32 b <- word = "new Uint32Array([" ++ show b ++ "])"
364− | JSWord64 b <- word = idrRTNamespace ++ "bigInt(\"" ++ show b ++ "\")"
358+ | JSWord64 b <- word = "i$bigInt(\"" ++ show b ++ "\")"
365359
366360codegenJavaScript :: CodeGenerator
367361codegenJavaScript ci =