chore: couple more inferences

This commit is contained in:
cha0s 2021-01-31 12:22:16 -06:00
parent 1bdbf8a0b4
commit 7d7f39961a

View File

@ -117,8 +117,26 @@ export default class Context {
return 'undefined';
default:
if (Array.isArray(value)) {
if (
2 === value.length
&& !Number.isNaN(parseInt(value[0], 10))
&& !Number.isNaN(parseInt(value[1], 10))
) {
return 'vector';
}
return 'array';
}
if ('undefined' !== typeof value.type) {
const types = [
'expressions',
'expression',
'invocation',
'literal',
];
if (-1 !== types.indexOf(value.type)) {
return value.type;
}
}
return 'object';
}
}