on master help sign in
javascript: initial Bits16 support
b3bf583raichoo
src/IRTS/CodegenJavaScript.hs+6−2
@@ -54,7 +54,9 @@ data JSNum = JSInt Int
54 deriving Eq
54 deriving Eq
55
55
56
56
57−data JSWord = JSWord8 Word8 deriving Eq
57+data JSWord = JSWord8 Word8
58+ | JSWord16 Word16
59+ deriving Eq
58
60
59
61
60data JSAnnotation = JSConstructor deriving Eq
62data JSAnnotation = JSConstructor deriving Eq
@@ -263,7 +265,8 @@ compileJS (JSWhile cond body) =
263 ++ "\n}"
265 ++ "\n}"
264
266
265compileJS (JSWord word)
267compileJS (JSWord word)
268+ | JSWord8 b <- word = show b
266− | JSWord8 b <- word = show b
269+ | JSWord16 b <- word = show b
267
270
268jsTailcall :: JS -> JS
271jsTailcall :: JS -> JS
269jsTailcall call =
272jsTailcall call =
@@ -1642,6 +1645,7 @@ translateConstant PtrType = JSType JSPtrTy
1642translateConstant Forgot = JSType JSForgotTy
1645translateConstant Forgot = JSType JSForgotTy
1643translateConstant (BI i) = jsBigInt $ JSString (show i)
1646translateConstant (BI i) = jsBigInt $ JSString (show i)
1644translateConstant (B8 b) = JSWord (JSWord8 b)
1647translateConstant (B8 b) = JSWord (JSWord8 b)
1648+translateConstant (B16 b) = JSWord (JSWord16 b)
1645translateConstant c =
1649translateConstant c =
1646 jsError $ "Unimplemented Constant: " ++ show c
1650 jsError $ "Unimplemented Constant: " ++ show c
1647
1651