fix: so track visited types
This commit is contained in:
parent
40bc7ac1c6
commit
103e34df0e
|
@ -103,6 +103,7 @@ export const defaultOps = (context, type, originalOps = []) => {
|
|||
const ops = [...originalOps];
|
||||
let evaluated;
|
||||
let {type: opsType} = descriptionFromOps(context, ops);
|
||||
const typesVisited = {[opsType]: true};
|
||||
while (!fitsInto(opsType, type) || 0 === ops.length) {
|
||||
evaluated = compile({type: 'expression', ops})(context);
|
||||
if (
|
||||
|
@ -121,9 +122,13 @@ export const defaultOps = (context, type, originalOps = []) => {
|
|||
const candidates = typeCandidates(description, type);
|
||||
const key = candidates.find((candidate) => {
|
||||
const {type: candidateType} = children[candidate];
|
||||
if (typesVisited[candidateType]) {
|
||||
return false;
|
||||
}
|
||||
if (fitsInto(type, candidateType)) {
|
||||
return true;
|
||||
}
|
||||
typesVisited[candidateType] = true;
|
||||
return true;
|
||||
});
|
||||
ops.push({type: 'key', key});
|
||||
|
|
Loading…
Reference in New Issue
Block a user