@@ -85,7 +85,7 @@ vsdHelp decls stuff =
8585 vsdHelp otherDecls $ stuff { _ports = port_ : _ports stuff }
8686
8787 Src.Docs docs ->
88− validateDocs docs otherDecls stuff
88+ validateDocs region docs otherDecls stuff
8989
9090 Src.Annotation (A.At _ name) tipe ->
9191 validateAnnotation region name tipe otherDecls stuff
@@ -100,40 +100,40 @@ vsdHelp decls stuff =
100100-- VALIDATE DOCS
101101
102102
103−validateDocs :: Text -> [Src.Decl] -> Stuff -> Result i w Stuff
104−validateDocs docs decls stuff =
103+validateDocs :: R.Region -> Text -> [Src.Decl] -> Stuff -> Result i w Stuff
104+validateDocs region docs decls stuff =
105105 case decls of
106106 [] ->
107− error "TODO no docs on nothing"
107+ Result.throw (Error.CommentOnNothing region)
108108
109109 A.At _ decl : _ ->
110− do name <- getNameForDocs decl
110+ do name <- getNameForDocs region decl
111111 vsdHelp decls $ stuff { _docs = Map.insert name docs (_docs stuff) }
112112
113113
114−getNameForDocs :: Src.Decl_ -> Result i w N.Name
115−getNameForDocs decl =
114+getNameForDocs :: R.Region -> Src.Decl_ -> Result i w N.Name
115+getNameForDocs region decl =
116116 case decl of
117117 Src.Union (A.At _ name) _ _ ->
118− return name
118+ Result.ok name
119119
120120 Src.Alias (A.At _ name) _ _ ->
121− return name
121+ Result.ok name
122122
123− Src.Binop _ _ _ _ ->
124− error "TODO no docs on binop"
123+ Src.Binop name _ _ _ ->
124+ Result.ok name
125125
126− Src.Port _ _ ->
127− error "TODO no docs on ports"
126+ Src.Port (A.At _ name) _ ->
127+ Result.ok name
128128
129129 Src.Docs _ ->
130− error "TODO no docs on docs"
130+ Result.throw (Error.CommentOnNothing region)
131131
132132 Src.Annotation (A.At _ name) _ ->
133− return name
133+ Result.ok name
134134
135135 Src.Definition (A.At _ name) _ _ ->
136− return name
136+ Result.ok name
137137
138138
139139
@@ -144,7 +144,7 @@ validateAnnotation :: R.Region -> N.Name -> Src.Type -> [Src.Decl] -> Stuff -> R
144144validateAnnotation annRegion annotationName tipe decls stuff =
145145 case decls of
146146 [] ->
147− error "TODO no attotations on nothing"
147+ Result.throw (Error.TypeWithoutDefinition annRegion annotationName)
148148
149149 A.At defRegion decl : otherDecls ->
150150 case decl of
@@ -156,10 +156,10 @@ validateAnnotation annRegion annotationName tipe decls stuff =
156156 vsdHelp otherDecls $ stuff { _decls = validDecl : _decls stuff }
157157
158158 else
159− error "TODO annotation does not match following definition"
159+ Result.throw (Error.TypeWithBadDefinition annRegion annotationName definitionName)
160160
161161 _ ->
162− error "TODO annotation needs to be on a definition"
162+ Result.throw (Error.TypeWithoutDefinition annRegion annotationName)
163163
164164
165165