mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-26 05:45:37 +03:00
core: move the first function into carp template
This commit is contained in:
parent
f25db98861
commit
d2235112dd
@ -18,6 +18,7 @@
|
||||
(load-once "Interfaces.carp")
|
||||
(load-once "Bool.carp")
|
||||
(load-once "Macros.carp")
|
||||
(load-once "Templates.carp")
|
||||
(load-once "Generics.carp")
|
||||
(load-once "Maybe.carp")
|
||||
(load-once "Result.carp")
|
||||
|
@ -72,7 +72,6 @@ pointerModule = Env { envBindings = bindings
|
||||
, envMode = ExternalEnv
|
||||
, envFunctionNestingLevel = 0 }
|
||||
where bindings = Map.fromList [ templatePointerCopy
|
||||
, templatePointerEqual
|
||||
, templatePointerToRef
|
||||
, templatePointerToValue
|
||||
, templatePointerAdd
|
||||
@ -94,16 +93,6 @@ templatePointerCopy = defineTemplate
|
||||
,"}"])
|
||||
(const [])
|
||||
|
||||
templatePointerEqual = defineTemplate
|
||||
(SymPath ["Pointer"] "eq")
|
||||
(FuncTy [PointerTy (VarTy "p"), PointerTy (VarTy "p")] BoolTy StaticLifetimeTy)
|
||||
"checks two pointers for equality."
|
||||
(toTemplate "bool $NAME ($p *p1, $p *p2)")
|
||||
(toTemplate $ unlines ["$DECL {"
|
||||
," return p1 == p2;"
|
||||
,"}"])
|
||||
(const [])
|
||||
|
||||
-- | A template function for converting pointers to ref (it's up to the user of this function to make sure that is a safe operation).
|
||||
templatePointerToRef = defineTemplate
|
||||
(SymPath ["Pointer"] "to-ref")
|
||||
|
Loading…
Reference in New Issue
Block a user