@@ -85,7 +85,7 @@ vsdHelp decls stuff =
85 vsdHelp otherDecls $ stuff { _ports = port_ : _ports stuff }
85 vsdHelp otherDecls $ stuff { _ports = port_ : _ports stuff }
87 Src.Docs docs ->
87 Src.Docs docs ->
88− validateDocs docs otherDecls stuff
88+ validateDocs region docs otherDecls stuff
90 Src.Annotation (A.At _ name) tipe ->
90 Src.Annotation (A.At _ name) tipe ->
91 validateAnnotation region name tipe otherDecls stuff
91 validateAnnotation region name tipe otherDecls stuff
@@ -100,40 +100,40 @@ vsdHelp decls stuff =
100-- VALIDATE DOCS
100-- VALIDATE DOCS
103−validateDocs :: Text -> [Src.Decl] -> Stuff -> Result i w Stuff
103+validateDocs :: R.Region -> Text -> [Src.Decl] -> Stuff -> Result i w Stuff
104−validateDocs docs decls stuff =
104+validateDocs region docs decls stuff =
105 case decls of
105 case decls of
107− error "TODO no docs on nothing"
107+ Result.throw (Error.CommentOnNothing region)
109 A.At _ decl : _ ->
109 A.At _ decl : _ ->
110− do name <- getNameForDocs decl
110+ do name <- getNameForDocs region decl
111 vsdHelp decls $ stuff { _docs = Map.insert name docs (_docs stuff) }
111 vsdHelp decls $ stuff { _docs = Map.insert name docs (_docs stuff) }
114−getNameForDocs :: Src.Decl_ -> Result i w N.Name
114+getNameForDocs :: R.Region -> Src.Decl_ -> Result i w N.Name
115−getNameForDocs decl =
115+getNameForDocs region decl =
116 case decl of
116 case decl of
117 Src.Union (A.At _ name) _ _ ->
117 Src.Union (A.At _ name) _ _ ->
118− return name
118+ Result.ok name
120 Src.Alias (A.At _ name) _ _ ->
120 Src.Alias (A.At _ name) _ _ ->
121− return name
121+ Result.ok name
123− Src.Binop _ _ _ _ ->
123+ Src.Binop name _ _ _ ->
124− error "TODO no docs on binop"
124+ Result.ok name
126− Src.Port _ _ ->
126+ Src.Port (A.At _ name) _ ->
127− error "TODO no docs on ports"
127+ Result.ok name
129 Src.Docs _ ->
129 Src.Docs _ ->
130− error "TODO no docs on docs"
130+ Result.throw (Error.CommentOnNothing region)
132 Src.Annotation (A.At _ name) _ ->
132 Src.Annotation (A.At _ name) _ ->
133− return name
133+ Result.ok name
135 Src.Definition (A.At _ name) _ _ ->
135 Src.Definition (A.At _ name) _ _ ->
136− return name
136+ Result.ok name
@@ -144,7 +144,7 @@ validateAnnotation :: R.Region -> N.Name -> Src.Type -> [Src.Decl] -> Stuff -> R
144validateAnnotation annRegion annotationName tipe decls stuff =
144validateAnnotation annRegion annotationName tipe decls stuff =
145 case decls of
145 case decls of
147− error "TODO no attotations on nothing"
147+ Result.throw (Error.TypeWithoutDefinition annRegion annotationName)
149 A.At defRegion decl : otherDecls ->
149 A.At defRegion decl : otherDecls ->
150 case decl of
150 case decl of
@@ -156,10 +156,10 @@ validateAnnotation annRegion annotationName tipe decls stuff =
156 vsdHelp otherDecls $ stuff { _decls = validDecl : _decls stuff }
156 vsdHelp otherDecls $ stuff { _decls = validDecl : _decls stuff }
159− error "TODO annotation does not match following definition"
159+ Result.throw (Error.TypeWithBadDefinition annRegion annotationName definitionName)
162− error "TODO annotation needs to be on a definition"
162+ Result.throw (Error.TypeWithoutDefinition annRegion annotationName)