git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #254
d3f05e6Phil Freeman
src/Language/PureScript/CodeGen/JS.hs+4−11
@@ -125,7 +125,7 @@ valueToJs opts m e (Accessor prop val) = JSAccessor prop (valueToJs opts m e val
125valueToJs opts m e (App val arg) = JSApp (valueToJs opts m e val) [valueToJs opts m e arg]
125valueToJs opts m e (App val arg) = JSApp (valueToJs opts m e val) [valueToJs opts m e arg]
126valueToJs opts m e (Abs (Left arg) val) = JSFunction Nothing [identToJs arg] (JSBlock [JSReturn (valueToJs opts m (bindName m arg e) val)])
126valueToJs opts m e (Abs (Left arg) val) = JSFunction Nothing [identToJs arg] (JSBlock [JSReturn (valueToJs opts m (bindName m arg e) val)])
127valueToJs opts m e (TypedValue _ (Abs (Left arg) val) ty) | optionsPerformRuntimeTypeChecks opts = let arg' = identToJs arg in JSFunction Nothing [arg'] (JSBlock $ runtimeTypeChecks arg' ty ++ [JSReturn (valueToJs opts m e val)])
127valueToJs opts m e (TypedValue _ (Abs (Left arg) val) ty) | optionsPerformRuntimeTypeChecks opts = let arg' = identToJs arg in JSFunction Nothing [arg'] (JSBlock $ runtimeTypeChecks arg' ty ++ [JSReturn (valueToJs opts m e val)])
128−valueToJs _ m e (Var ident) = varToJs m e ident
128+valueToJs _ m _ (Var ident) = varToJs m ident
129valueToJs opts m e (TypedValue _ val _) = valueToJs opts m e val
129valueToJs opts m e (TypedValue _ val _) = valueToJs opts m e val
130valueToJs _ _ _ (TypeClassDictionary _ _) = error "Type class dictionary was not replaced"
130valueToJs _ _ _ (TypeClassDictionary _ _) = error "Type class dictionary was not replaced"
131valueToJs _ _ _ _ = error "Invalid argument to valueToJs"
131valueToJs _ _ _ _ = error "Invalid argument to valueToJs"
@@ -182,16 +182,9 @@ runtimeTypeChecks arg ty =
182-- Generate code in the simplified Javascript intermediate representation for a reference to a
182-- Generate code in the simplified Javascript intermediate representation for a reference to a
183-- variable.
183-- variable.
184--
184--
185−varToJs :: ModuleName -> Environment -> Qualified Ident -> JS
185+varToJs :: ModuleName -> Qualified Ident -> JS
186−varToJs m e qual@(Qualified _ ident) = go qual
187− where
188− go qual' = case M.lookup (qualify m qual') (names e) of
189− Just (_, ty) | isExtern ty -> var ident
190− _ -> case qual' of
191− Qualified Nothing _ -> var ident
186+varToJs _ (Qualified Nothing ident) = var ident
192− _ -> qualifiedToJS m id qual'
187+varToJs m qual = qualifiedToJS m id qual
193− isExtern (Extern ForeignImport) = True
194− isExtern _ = False
195
188
196-- |
189-- |
197-- Generate code in the simplified Javascript intermediate representation for a reference to a
190-- Generate code in the simplified Javascript intermediate representation for a reference to a