fixed lazy eval after variable update

This commit is contained in:
Sander Hautvast 2021-03-02 14:38:58 +01:00
parent 26d4749995
commit 41c7551b4b

View file

@ -10,7 +10,7 @@ import {
const state = {}; // binding -> value const state = {}; // binding -> value
const bindings = {}; // binding -> {name:binding_name, evaluated: evaluated_lazy_value, previous: previous_value} const bindings = {}; // binding -> {name:binding_name, evaluated: evaluated_lazy_value, previous: previous_value}
const references = {}; const references = {}; // for retrieval of objects by reference (@n, where n is a number)
const command_input_element = document.getElementById('command_input'); const command_input_element = document.getElementById('command_input');
const command_history_element = document.getElementById('command_history'); const command_history_element = document.getElementById('command_history');
command_input_element.value = ''; command_input_element.value = '';
@ -107,10 +107,11 @@ const handle_enter = function () {
if (binding) { if (binding) {
bindings[binding].evaluated = value; // store evaluation result bindings[binding].evaluated = value; // store evaluation result
} }
if (value.is_visual) { if (value.is_visual) {
if (value.is_vector) { if (value.is_vector) {
if (binding && bindings[binding].previous && bindings[binding].previous.is_visual) { if (binding && bindings[binding].previous && bindings[binding].previous.is_visual) {
update_vector_arrow(value.previous.id, value); update_vector_arrow(bindings[binding].previous.id, value);
} else { } else {
if (value.is_new) { if (value.is_new) {
value.label_text = binding ? binding : ""; value.label_text = binding ? binding : "";
@ -120,6 +121,7 @@ const handle_enter = function () {
} }
} }
} }
update_lazy_objects();
if (value.description) { if (value.description) {
value = value.description; value = value.description;
} }