fix: var safety

This commit is contained in:
cha0s 2020-06-22 10:30:42 -05:00
parent a8702b190c
commit 69a2c613c9

View File

@ -58,7 +58,12 @@ export function descriptionFromSteps(context, steps) {
let variable;
for (let i = 0; i < keyStepsCount; ++i) {
const {key} = steps[i];
variable = 0 === i ? context.get(key)[0] : variable[key];
if (0 === i) {
[variable] = context.get(key);
}
else {
variable = 'object' === typeof variable ? variable[key] : undefined;
}
const lookupDesc = Context.typeDescription(
description[key].type,
(isInvocation && keyStepsCount - 1 === i) ? undefined : variable,
@ -83,7 +88,12 @@ export function stepsOptions(context, steps, type) {
let variable;
for (let j = 0; j < i; ++j) {
const {key} = steps[j];
variable = 0 === j ? context.get(key)[0] : variable[key];
if (0 === i) {
[variable] = context.get(key);
}
else {
variable = 'object' === typeof variable ? variable[key] : undefined;
}
description = Context.typeDescription(description[key].type, variable);
}
const options = 'any' === type