From 4a6caee70257a302c1d323cde774e109c60a1839 Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Wed, 22 Jun 2022 06:24:53 +0300 Subject: [PATCH] Fix simulation bug due to missing await --- lib/utils/simulation.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/utils/simulation.dart b/lib/utils/simulation.dart index 1444aba..ea20206 100644 --- a/lib/utils/simulation.dart +++ b/lib/utils/simulation.dart @@ -30,11 +30,16 @@ class SimulatedComponent { } Future> simulate(Map inputs) async { - final input = int.parse(component.inputs.map((input) => inputs[input]! ? '1' : '0').join(), radix: 2); + final input = int.parse( + component.inputs.map((input) => inputs[input]! ? '1' : '0').join(), + radix: 2, + ); if (component.truthTable != null) { final output = component.truthTable![input]; return { - for (final it in component.outputs.indexedMap((index, outName) => [outName, output[index]])) + for (final it in component.outputs.indexedMap( + (index, outName) => [outName, output[index]] + )) it[0] : it[1] == '1' }; } @@ -62,7 +67,7 @@ class SimulatedComponent { // Create instances final wiring = state!.wiring; for (final instance in wiring.instances) { - _getInstance(instance.instanceId, instance.componentId); + await _getInstance(instance.instanceId, instance.componentId); } // Simulate