mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-01 09:49:24 +03:00
prim void to js codegen (#782)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
This commit is contained in:
parent
08a35d694c
commit
910711afe9
@ -308,7 +308,7 @@ jsOp (Cast Bits64Type Bits16Type) [x] = boundedUInt 16 x
|
||||
jsOp (Cast Bits64Type Bits32Type) [x] = boundedUInt 32 x
|
||||
|
||||
jsOp (Cast ty StringType) [x] = pure $ "(''+" ++ x ++ ")"
|
||||
jsOp (Cast ty ty2) [x] = jsCrashExp $ "invalid cast: + " ++ show ty ++ " + ' -> ' + " ++ show ty2
|
||||
jsOp (Cast ty ty2) [x] = jsCrashExp $ jsString $ "invalid cast: + " ++ show ty ++ " + ' -> ' + " ++ show ty2
|
||||
jsOp BelieveMe [_,_,x] = pure x
|
||||
jsOp (Crash) [_, msg] = jsCrashExp msg
|
||||
|
||||
@ -377,6 +377,8 @@ jsPrim (NS _ (UN "prim__os")) [] =
|
||||
let oscalc = "(o => o === 'linux'?'unix':o==='win32'?'windows':o)"
|
||||
sysos <- addConstToPreamble "sysos" (oscalc ++ "(" ++ os ++ ".platform())")
|
||||
pure sysos
|
||||
jsPrim (NS _ (UN "void")) [_, _] = jsCrashExp $ jsString $ "Error: Executed 'void'" -- DEPRECATED. TODO: remove when bootstrap has been updated
|
||||
jsPrim (NS _ (UN "prim__void")) [_, _] = jsCrashExp $ jsString $ "Error: Executed 'void'"
|
||||
jsPrim x args = throw $ InternalError $ "prim not implemented: " ++ (show x)
|
||||
|
||||
tag2es : Either Int String -> String
|
||||
|
@ -284,7 +284,8 @@ toPrim pn@(NS _ n)
|
||||
(n == UN "prim__arraySet", ArraySet),
|
||||
(n == UN "prim__getField", GetField),
|
||||
(n == UN "prim__setField", SetField),
|
||||
(n == UN "void", VoidElim),
|
||||
(n == UN "void", VoidElim), -- DEPRECATED. TODO: remove when bootstrap has been updated
|
||||
(n == UN "prim__void", VoidElim),
|
||||
(n == UN "prim__os", SysOS),
|
||||
(n == UN "prim__codegen", SysCodegen),
|
||||
(n == UN "prim__onCollect", OnCollect),
|
||||
|
@ -236,7 +236,8 @@ toPrim pn@(NS _ n)
|
||||
(n == UN "prim__arraySet", ArraySet),
|
||||
(n == UN "prim__getField", GetField),
|
||||
(n == UN "prim__setField", SetField),
|
||||
(n == UN "void", VoidElim),
|
||||
(n == UN "void", VoidElim), -- DEPRECATED. TODO: remove when bootstrap has been updated
|
||||
(n == UN "prim__void", VoidElim),
|
||||
(n == UN "prim__os", SysOS),
|
||||
(n == UN "prim__codegen", SysCodegen),
|
||||
(n == UN "prim__onCollect", OnCollect),
|
||||
|
Loading…
Reference in New Issue
Block a user