Skip to content

Commit

Permalink
optimize assertion message generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sekiguchi-nagisa committed Apr 13, 2024
1 parent e9a5d00 commit feb559b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ void raiseAssertFail(ARState &st, Value &&msg, const AssertOp op, Value &&left,
value += " <LHS>: ";
value += st.typePool.get(left.getTypeID()).getNameRef();
value += " = ";
appendAsPrintable(left.toString(), MAX_PRINTABLE + value.size(), value);
appendAsPrintable(left.hasStrRef() ? left.asStrRef() : left.toString(),
MAX_PRINTABLE + value.size(), value);
value += "\n <RHS>: ";
value += st.typePool.get(right.getTypeID()).getNameRef();
value += " = ";
appendAsPrintable(right.toString(), MAX_PRINTABLE + value.size(), value);
appendAsPrintable(right.hasStrRef() ? right.asStrRef() : right.toString(),
MAX_PRINTABLE + value.size(), value);
msg = Value::createStr(std::move(value));
break;
}
Expand Down

0 comments on commit feb559b

Please sign in to comment.