on master help sign in
javascript: initial Bits16 support
commitb3bf5831e97eb12c68b3a90314515459b868bdc3 authorraichoo <raichoo@googlemail.com> dateSat 12 Apr 2014, 02:50 (13 years ago) parent64f7716
1 file changed+6−2
src/IRTS/CodegenJavaScript.hs+6−2
src/IRTS/CodegenJavaScript.hs+6−2
@@ -54,7 +54,9 @@ data JSNum = JSInt Int
5454 deriving Eq
5555
5656
57−data JSWord = JSWord8 Word8 deriving Eq
57+data JSWord = JSWord8 Word8
58+ | JSWord16 Word16
59+ deriving Eq
5860
5961
6062data JSAnnotation = JSConstructor deriving Eq
@@ -263,7 +265,8 @@ compileJS (JSWhile cond body) =
263265 ++ "\n}"
264266
265267compileJS (JSWord word)
266− | JSWord8 b <- word = show b
268+ | JSWord8 b <- word = show b
269+ | JSWord16 b <- word = show b
267270
268271jsTailcall :: JS -> JS
269272jsTailcall call =
@@ -1642,6 +1645,7 @@ translateConstant PtrType = JSType JSPtrTy
16421645translateConstant Forgot = JSType JSForgotTy
16431646translateConstant (BI i) = jsBigInt $ JSString (show i)
16441647translateConstant (B8 b) = JSWord (JSWord8 b)
1648+translateConstant (B16 b) = JSWord (JSWord16 b)
16451649translateConstant c =
16461650 jsError $ "Unimplemented Constant: " ++ show c
16471651