fix: default expressions
This commit is contained in:
parent
bf11fa194b
commit
003834b3a0
|
@ -75,12 +75,18 @@ const defaultInvocation = (context, ops) => {
|
|||
type: 'invoke',
|
||||
args: args.map(([, {type}]) => {
|
||||
const {defaultLiteral} = typeDescription(type, undefined);
|
||||
if ('undefined' !== defaultLiteral) {
|
||||
if ('undefined' !== typeof defaultLiteral) {
|
||||
return ({
|
||||
type: 'literal',
|
||||
value: defaultLiteral,
|
||||
});
|
||||
}
|
||||
if ('expressions' === type) {
|
||||
return {
|
||||
type: 'expressions',
|
||||
expressions: [],
|
||||
};
|
||||
}
|
||||
return ({
|
||||
type: 'expression',
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
@ -93,7 +99,8 @@ const defaultInvocation = (context, ops) => {
|
|||
export const defaultOps = (context, type, originalOps = []) => {
|
||||
const ops = [...originalOps];
|
||||
let evaluated;
|
||||
let {type: opsType} = descriptionFromOps(context, originalOps);
|
||||
debugger;
|
||||
let {type: opsType} = descriptionFromOps(context, ops);
|
||||
const typesVisited = {[opsType]: true};
|
||||
while (!fitsInto(opsType, type) || 0 === ops.length) {
|
||||
evaluated = compile({type: 'expression', ops})(context);
|
||||
|
@ -133,5 +140,6 @@ export const defaultOps = (context, type, originalOps = []) => {
|
|||
if ('function' === typeof evaluated) {
|
||||
ops.push(defaultInvocation(context, ops));
|
||||
}
|
||||
console.log({dops: ops})
|
||||
return ops;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user