on master help sign in
javascript: remove old namespaces
e4d23ecraichoo
jsrts/jsbn/jsbn.js+3−3
@@ -1,4 +1,4 @@
1−var __IDRRT__bigInt = (function() {
1+var i$bigInt = (function() {
2// Copyright (c) 2005 Tom Wu
2// Copyright (c) 2005 Tom Wu
3// All Rights Reserved.
3// All Rights Reserved.
4// See "LICENSE" for details.
4// See "LICENSE" for details.
@@ -1234,5 +1234,5 @@ return function(val) {
1234}
1234}
1235})();
1235})();
1236
1236
1237−var __IDRRT__ZERO = __IDRRT__bigInt("0");
1237+var i$ZERO = i$bigInt("0");
1238−var __IDRRT__ONE = __IDRRT__bigInt("1");
1238+var i$ONE = i$bigInt("1");
src/IRTS/CodegenJavaScript.hs+11−17
@@ -24,12 +24,6 @@ import System.IO
24import System.Directory
24import System.Directory
25
25
26
26
27−idrNamespace :: String
28−idrNamespace = "__IDR__"
29−idrRTNamespace = "__IDRRT__"
30−idrLTNamespace = "__IDRLT__"
31−idrCTRNamespace = "__IDRCTR__"
32−
33data CompileInfo = CompileInfo { compileInfoApplyCases :: [Int]
27data CompileInfo = CompileInfo { compileInfoApplyCases :: [Int]
34 , compileInfoEvalCases :: [Int]
28 , compileInfoEvalCases :: [Int]
35 , compileInfoNeedsBigInt :: Bool
29 , compileInfoNeedsBigInt :: Bool
@@ -214,13 +208,13 @@ compileJS' indent (JSFunction args body) =
214 ++ "\n}\n"
208 ++ "\n}\n"
215
209
216compileJS' indent (JSType ty)
210compileJS' indent (JSType ty)
217− | JSIntTy <- ty = idrRTNamespace ++ "Int"
211+ | JSIntTy <- ty = "i$Int"
218− | JSStringTy <- ty = idrRTNamespace ++ "String"
212+ | JSStringTy <- ty = "i$String"
219− | JSIntegerTy <- ty = idrRTNamespace ++ "Integer"
213+ | JSIntegerTy <- ty = "i$Integer"
220− | JSFloatTy <- ty = idrRTNamespace ++ "Float"
214+ | JSFloatTy <- ty = "i$Float"
221− | JSCharTy <- ty = idrRTNamespace ++ "Char"
215+ | JSCharTy <- ty = "i$Char"
222− | JSPtrTy <- ty = idrRTNamespace ++ "Ptr"
216+ | JSPtrTy <- ty = "i$Ptr"
223− | JSForgotTy <- ty = idrRTNamespace ++ "Forgot"
217+ | JSForgotTy <- ty = "i$Forgot"
224
218
225compileJS' indent (JSSeq seq) =
219compileJS' indent (JSSeq seq) =
226 intercalate ";\n" (
220 intercalate ";\n" (
@@ -284,10 +278,10 @@ compileJS' indent (JSString str) =
284compileJS' indent (JSNum num)
278compileJS' indent (JSNum num)
285 | JSInt i <- num = show i
279 | JSInt i <- num = show i
286 | JSFloat f <- num = show f
280 | JSFloat f <- num = show f
287− | JSInteger JSBigZero <- num = "__IDRRT__ZERO"
281+ | JSInteger JSBigZero <- num = "i$ZERO"
288− | JSInteger JSBigOne <- num = "__IDRRT__ONE"
282+ | JSInteger JSBigOne <- num = "i$ONE"
289 | JSInteger (JSBigInt i) <- num = show i
283 | 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 ++ ")"
291
285
292compileJS' indent (JSAssign lhs rhs) =
286compileJS' indent (JSAssign lhs rhs) =
293 compileJS' indent lhs ++ " = " ++ compileJS' indent rhs
287 compileJS' indent lhs ++ " = " ++ compileJS' indent rhs
@@ -361,7 +355,7 @@ compileJS' indent (JSWord word)
361 | JSWord8 b <- word = "new Uint8Array([" ++ show b ++ "])"
355 | JSWord8 b <- word = "new Uint8Array([" ++ show b ++ "])"
362 | JSWord16 b <- word = "new Uint16Array([" ++ show b ++ "])"
356 | JSWord16 b <- word = "new Uint16Array([" ++ show b ++ "])"
363 | JSWord32 b <- word = "new Uint32Array([" ++ show b ++ "])"
357 | JSWord32 b <- word = "new Uint32Array([" ++ show b ++ "])"
364− | JSWord64 b <- word = idrRTNamespace ++ "bigInt(\"" ++ show b ++ "\")"
358+ | JSWord64 b <- word = "i$bigInt(\"" ++ show b ++ "\")"
365
359
366codegenJavaScript :: CodeGenerator
360codegenJavaScript :: CodeGenerator
367codegenJavaScript ci =
361codegenJavaScript ci =