@@ -38,20 +38,15 @@ constrain env (L span expr) tipe =
38 case expr of
38 case expr of
39 Literal lit -> liftIO $ Literal.constrain env span lit tipe
39 Literal lit -> liftIO $ Literal.constrain env span lit tipe
41− GLShader _ src -> case declsRecord <$> PH.glSource src of
41+ GLShader uid src -> case PH.glSource src of
42− Nothing -> throwError [PP.text "Some sort of GLSL parse error"]
42+ Nothing -> throwError [PP.text $ "Some sort of GLSL parse error" ++ uid]
43− Just sourceTipe -> return . L span $ CEqual tipe (shaderTipe sourceTipe)
43+ Just sourceDecls -> return . L span $ CEqual tipe (shaderTipe attribute uniform varying)
45− shaderTipe t = Env.get env Env.types "Graphics.WebGL.Shader" <| t
45+ shaderTipe a u v = Env.get env Env.types "Graphics.WebGL.Shader" <| a <| u <| v
46 glTipe = Env.get env Env.types . PH.glTipeName
46 glTipe = Env.get env Env.types . PH.glTipeName
47− declsRecord :: PH.GLShaderDecls -> TermN Variable
48− declsRecord extractedTipes = record (fields' extractedTipes) (TermN EmptyRecord1)
49− fields' :: PH.GLShaderDecls -> Map.Map String [Type]
50− fields' extractedTipes = Map.fromList
51− [ ("attribute", [record (Map.map (\t -> [glTipe t]) $ PH.attribute extractedTipes) (TermN EmptyRecord1) ] )
47+ attribute = record (Map.map (\t -> [glTipe t]) $ PH.attribute sourceDecls) (TermN EmptyRecord1)
52− , ("uniform", [record (Map.map (\t -> [glTipe t]) $ PH.uniform extractedTipes) (TermN EmptyRecord1) ] )
48+ uniform = record (Map.map (\t -> [glTipe t]) $ PH.uniform sourceDecls) (TermN EmptyRecord1)
53− , ("varying", [record (Map.map (\t -> [glTipe t]) $ PH.varying extractedTipes) (TermN EmptyRecord1) ] )
49+ varying = record (Map.map (\t -> [glTipe t]) $ PH.varying sourceDecls) (TermN EmptyRecord1)
57 Var name | name == saveEnvName -> return (L span CSaveEnv)
52 Var name | name == saveEnvName -> return (L span CSaveEnv)