Fixed referencing variable.description in a calculation
Whether the description's inline calculations are calculated or not is not defined.
This commit is contained in:
@@ -26,6 +26,10 @@ function discoverInlineCalculationFields(prop, schemas){
|
|||||||
unset(prop, calcKey);
|
unset(prop, calcKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the value to the uncomputed string for use in calculations
|
||||||
|
inlineCalcObj.value = string;
|
||||||
|
|
||||||
// Has the text, if it matches the existing hash, stop
|
// Has the text, if it matches the existing hash, stop
|
||||||
const inlineCalcHash = cyrb53(inlineCalcObj.text);
|
const inlineCalcHash = cyrb53(inlineCalcObj.text);
|
||||||
if (inlineCalcHash === inlineCalcObj.hash){
|
if (inlineCalcHash === inlineCalcObj.hash){
|
||||||
@@ -33,10 +37,9 @@ function discoverInlineCalculationFields(prop, schemas){
|
|||||||
}
|
}
|
||||||
inlineCalcObj.hash = inlineCalcHash;
|
inlineCalcObj.hash = inlineCalcHash;
|
||||||
inlineCalcObj.inlineCalculations = [];
|
inlineCalcObj.inlineCalculations = [];
|
||||||
// Set the value to the uncomputed string for use in calculations
|
|
||||||
// It will be re set including the embedded calculation at the end of
|
// It will be re set including the embedded calculation at the end of
|
||||||
// the computation
|
// the computation
|
||||||
inlineCalcObj.value = string;
|
|
||||||
let matches = string.matchAll(INLINE_CALCULATION_REGEX);
|
let matches = string.matchAll(INLINE_CALCULATION_REGEX);
|
||||||
for (let match of matches){
|
for (let match of matches){
|
||||||
let calculation = match[1];
|
let calculation = match[1];
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ const accessor = {
|
|||||||
value = value[name];
|
value = value[name];
|
||||||
});
|
});
|
||||||
let valueType = typeof value;
|
let valueType = typeof value;
|
||||||
|
// If the accessor returns an objet, get the object's value instead
|
||||||
|
while (valueType === 'object'){
|
||||||
|
value = value.value;
|
||||||
|
valueType = typeof value;
|
||||||
|
}
|
||||||
|
// Return a parse node based on the type returned
|
||||||
if (valueType === 'string' || valueType === 'number' || valueType === 'boolean'){
|
if (valueType === 'string' || valueType === 'number' || valueType === 'boolean'){
|
||||||
return {
|
return {
|
||||||
result: constant.create({
|
result: constant.create({
|
||||||
@@ -34,6 +40,7 @@ const accessor = {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
context.error(`${node.name} returned an unexpected type`);
|
context.error(`${node.name} returned an unexpected type`);
|
||||||
|
context.error(JSON.stringify(value, null, 2));
|
||||||
return {
|
return {
|
||||||
result: accessor.create({
|
result: accessor.create({
|
||||||
name: node.name,
|
name: node.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user