summaryrefslogtreecommitdiff
path: root/src/wast-parser.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-10-19 11:00:39 -0700
committerGitHub <noreply@github.com>2017-10-19 11:00:39 -0700
commitfa3ee1d2ff3ae74208bc1ccc4ab8621b4a3b201e (patch)
tree5aaa748c2a721511fb882dffbb4f452e59147742 /src/wast-parser.cc
parent1c4d51e96077798bf6bd0dfa82f65259a07bd314 (diff)
downloadwabt-fa3ee1d2ff3ae74208bc1ccc4ab8621b4a3b201e.tar.gz
wabt-fa3ee1d2ff3ae74208bc1ccc4ab8621b4a3b201e.tar.bz2
wabt-fa3ee1d2ff3ae74208bc1ccc4ab8621b4a3b201e.zip
Set the `loc` member in `Const` (#657)
After the switch to the recursive descent parser, this wasn't properly being set. As a result, certain errors would not have a proper location.
Diffstat (limited to 'src/wast-parser.cc')
-rw-r--r--src/wast-parser.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index fffdcf5e..c95a33df 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -1446,7 +1446,7 @@ Result WastParser::ParseConst(Const* const_) {
Opcode opcode = Consume().opcode();
Literal literal;
- Location loc = GetLocation();
+ const_->loc = GetLocation();
switch (Peek()) {
case TokenType::Nat:
@@ -1493,7 +1493,7 @@ Result WastParser::ParseConst(Const* const_) {
}
if (Failed(result)) {
- Error(loc, "invalid literal \"%s\"", literal.text.c_str());
+ Error(const_->loc, "invalid literal \"%s\"", literal.text.c_str());
}
return Result::Ok;