Fixed function being replaced with object['value'] accessors

This commit is contained in:
Thaum Rystra
2020-05-08 16:20:00 +02:00
parent e934f92e8b
commit 6c8e9037e1

View File

@@ -1,7 +1,17 @@
import * as math from 'mathjs';
export default function replaceBareSymbolsWithValueAccessor(node, path) {
if (node.isSymbolNode && path !== 'object') {
if (node.isFunctionNode){
let fn = node.fn;
if (fn && fn.isSymbolNode){
fn.skipReplacement = true;
}
return node;
} else if (
node.isSymbolNode &&
path !== 'object' &&
node.skipReplacement !== true
) {
const object = new math.SymbolNode(node.name);
const address = new math.ConstantNode('value');
const index = new math.IndexNode([address]);