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