Browse Source

Fix circuit generation in situation of literal assignments.

Thomas Kerber 1 year 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)
303 303
 			}
304 304
 			auto idx = dynamic_pointer_cast<LiteralNodeValue>(m_values[ia->indexExpression()])->value();
305 305
 			auto rhs = m_values[&_assign.rightHandSide()];
306
+			if(rhs->kind() == NodeValue::Kind::Literal) {
307
+				rhs = make_shared<WireNodeValue>(
308
+					encodeLiteral(
309
+						*dynamic_pointer_cast<LiteralNodeValue>(rhs)));
310
+			}
306 311
 			assert(rhs->kind() == NodeValue::Kind::Wire);
307 312
 			wires[idx] = dynamic_pointer_cast<WireNodeValue>(rhs)->wire();
308 313
 			m_values[id->annotation().referencedDeclaration] = make_shared<WireArrayNodeValue>(wires);

Loading…
Cancel
Save