Skip to content
Snippets Groups Projects
Commit 79142cbb authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

Bindings: Add convenience method for requiring an attribute

(cherry picked from commit fb692e5f)
parent 0d118ef0
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,14 @@ public:
return {};
}
Attr & need(const Symbol & name, const Pos & pos = noPos)
{
auto a = get(name);
if (!a)
throw Error("attribute '%s' missing, at %s", name, pos);
return **a;
}
iterator begin() { return &attrs[0]; }
iterator end() { return &attrs[size_]; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment