fix for undefined, back to production mode

This commit is contained in:
Sander Hautvast 2021-03-05 19:43:38 +01:00
parent 30a74579f9
commit 83bbc5edab
2 changed files with 32 additions and 28 deletions

View file

@ -134,38 +134,42 @@ const handle_enter = function () {
let tokens = scan(command); let tokens = scan(command);
let statement = parse(tokens); let statement = parse(tokens);
value = visit(statement); value = visit(statement);
let binding; if (value !== undefined) {
if (value.is_binding) { // if it's declaration work with the initializer let binding;
binding = value.name; // but we also need the name of the bound variable if (value.is_binding) { // if it's declaration work with the initializer
value = state[binding]; // lookup the value for the binding binding = value.name; // but we also need the name of the bound variable
} else if (Object.prototype.hasOwnProperty.call(value, ['id'])) { value = state[binding]; // lookup the value for the binding
references['@' + value.id] = value; } else if (Object.prototype.hasOwnProperty.call(value, ['id'])) {
} references['@' + value.id] = value;
while (value.lazy_expression) { }
value = value.get(); while (value.lazy_expression) {
} value = value.get();
if (binding) { }
bindings[binding].evaluated = value; // store evaluation result if (binding) {
} bindings[binding].evaluated = value; // store evaluation result
}
if (value.is_visual) { if (value.is_visual) {
if (binding && bindings[binding].previous && bindings[binding].previous.is_visual) { if (binding && bindings[binding].previous && bindings[binding].previous.is_visual) {
update_vector_arrow(bindings[binding].previous.id, value); update_vector_arrow(bindings[binding].previous.id, value);
} else {
if (value.is_new) {
value.label_text = binding ? binding : "";
value.is_new = false;
add_vector_arrow(value);
}
}
} else { } else {
if (value.is_new) { if (binding && bindings[binding].previous && bindings[binding].previous.is_visual) {
value.label_text = binding ? binding : ""; label(bindings[binding].previous, '@' + bindings[binding].previous.id);
value.is_new = false;
add_vector_arrow(value);
} }
} }
} else { update_visible_objects();
if (binding && bindings[binding].previous && bindings[binding].previous.is_visual) { if (value.description) {
label(bindings[binding].previous, '@' + bindings[binding].previous.id); value = value.description;
} }
} } else {
update_visible_objects(); value = 'value is undefined';
if (value.description) {
value = value.description;
} }
} catch (exception) { } catch (exception) {
value = exception.message; value = exception.message;

View file

@ -2,7 +2,7 @@ const path = require('path');
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = { module.exports = {
mode: 'development', mode: 'production',
entry: './src/js/index.js', entry: './src/js/index.js',
output: { output: {