Browse Source

Fix circuit generation in situation of literal assignments.

master
Thomas Kerber 2 years ago
parent
commit
86925593ba
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      libsolidity/codegen/CircuitCompiler.cpp

+ 5
- 0
libsolidity/codegen/CircuitCompiler.cpp View File

@@ -303,6 +303,11 @@ void CircuitCompiler::endVisit(Assignment const& _assign)
}
auto idx = dynamic_pointer_cast<LiteralNodeValue>(m_values[ia->indexExpression()])->value();
auto rhs = m_values[&_assign.rightHandSide()];
if(rhs->kind() == NodeValue::Kind::Literal) {
rhs = make_shared<WireNodeValue>(
encodeLiteral(
*dynamic_pointer_cast<LiteralNodeValue>(rhs)));
}
assert(rhs->kind() == NodeValue::Kind::Wire);
wires[idx] = dynamic_pointer_cast<WireNodeValue>(rhs)->wire();
m_values[id->annotation().referencedDeclaration] = make_shared<WireArrayNodeValue>(wires);

Loading…
Cancel
Save