add compiler support for expression lines.
This commit is contained in:
parent
eadd722f39
commit
b9582163cc
|
@ -70,6 +70,25 @@ export function compile_line (env, line) {
|
|||
};
|
||||
}
|
||||
|
||||
if (line.type === Line.Expression) {
|
||||
let value;
|
||||
let valid = true;
|
||||
|
||||
try {
|
||||
value = evaluate(env, line.value);
|
||||
} catch (e) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (!valid) return invalid();
|
||||
|
||||
return {
|
||||
valid: true,
|
||||
env: env,
|
||||
value: value,
|
||||
};
|
||||
}
|
||||
|
||||
return invalid();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue