@@ -2,7 +2,7 @@
22module Generate.JavaScript.Ports (incoming, outgoing) where
33
44import Generate.JavaScript.Helpers
5−import Generate.JavaScript.Variable (nativePorts, nativeJson)
5+import qualified Generate.JavaScript.Variable as V
66import AST.Type as T
77import qualified AST.Variable as Var
88import Language.ECMAScript3.Syntax
@@ -30,7 +30,7 @@ incoming tipe =
3030 Aliased _ t -> incoming t
3131
3232 App (Type v) [t]
33− | Var.isSignal v -> nativePorts "incomingSignal" <| incoming t
33+ | Var.isSignal v -> V.value "Native.Ports" "incomingSignal" <| incoming t
3434
3535 _ -> ["v"] ==> inc tipe (ref "v")
3636
@@ -51,15 +51,15 @@ inc tipe x =
5151 from checks = check x checks x
5252
5353 Type name
54− | Var.isJson name -> nativeJson "fromJS" <| x
54+ | Var.isJson name -> V.value "Native.Json" "fromJS" <| x
5555 | otherwise -> error "bad type got to incoming port generation code"
5656
5757 App f args ->
5858 case f : args of
5959 Type name : [t]
6060 | Var.isMaybe name -> CondExpr () (equal x (NullLit ()))
61− (obj ["Maybe","Nothing"])
62− (obj ["Maybe","Just"] <| inc t x)
61+ (V.value "Maybe" "Nothing")
62+ (V.value "Maybe" "Just" <| inc t x)
6363
6464 | Var.isList name -> check x JSArray (obj ["_L","fromArray"] <| array)
6565
@@ -97,7 +97,7 @@ outgoing tipe =
9797 Aliased _ t -> outgoing t
9898
9999 App (Type v) [t]
100− | Var.isSignal v -> nativePorts "outgoingSignal" <| outgoing t
100+ | Var.isSignal v -> V.value "Native.Ports" "outgoingSignal" <| outgoing t
101101
102102 _ -> ["v"] ==> out tipe (ref "v")
103103
@@ -126,7 +126,7 @@ out tipe x =
126126 | name `elem` ["Int","Float","Bool","String"] -> x
127127
128128 Type name
129− | Var.isJson name -> nativeJson "toJS" <| x
129+ | Var.isJson name -> V.value "Native.Json" "toJS" <| x
130130 | otherwise -> error "bad type got to outgoing port generation code"
131131
132132 App f args ->