Refactoring yul source locations.

This commit is contained in:
Djordje Mijovic
2021-05-04 16:05:23 +02:00
parent fe4822a1d2
commit e404b6e7a6
62 changed files with 394 additions and 358 deletions
+6 -6
View File
@@ -100,7 +100,7 @@ void ConstantOptimiser::visit(Expression& _e)
if (
Expression const* repr =
RepresentationFinder(m_dialect, m_meter, locationOf(_e), m_cache)
RepresentationFinder(m_dialect, m_meter, debugDataOf(_e), m_cache)
.tryFindRepresentation(valueOfLiteral(literal))
)
_e = ASTCopier{}.translate(*repr);
@@ -180,7 +180,7 @@ Representation const& RepresentationFinder::findRepresentation(u256 const& _valu
Representation RepresentationFinder::represent(u256 const& _value) const
{
Representation repr;
repr.expression = make_unique<Expression>(Literal{m_location, LiteralKind::Number, YulString{formatNumber(_value)}, {}});
repr.expression = make_unique<Expression>(Literal{m_debugData, LiteralKind::Number, YulString{formatNumber(_value)}, {}});
repr.cost = m_meter.costs(*repr.expression);
return repr;
}
@@ -192,8 +192,8 @@ Representation RepresentationFinder::represent(
{
Representation repr;
repr.expression = make_unique<Expression>(FunctionCall{
m_location,
Identifier{m_location, _instruction},
m_debugData,
Identifier{m_debugData, _instruction},
{ASTCopier{}.translate(*_argument.expression)}
});
repr.cost = _argument.cost + m_meter.instructionCosts(*m_dialect.builtin(_instruction)->instruction);
@@ -208,8 +208,8 @@ Representation RepresentationFinder::represent(
{
Representation repr;
repr.expression = make_unique<Expression>(FunctionCall{
m_location,
Identifier{m_location, _instruction},
m_debugData,
Identifier{m_debugData, _instruction},
{ASTCopier{}.translate(*_arg1.expression), ASTCopier{}.translate(*_arg2.expression)}
});
repr.cost = m_meter.instructionCosts(*m_dialect.builtin(_instruction)->instruction) + _arg1.cost + _arg2.cost;