refactor: triple dot for vararg

This commit is contained in:
cha0s 2021-01-31 02:30:00 -06:00
parent 4a670a58df
commit f6d9b194ed
2 changed files with 10 additions and 5 deletions

View File

@ -72,7 +72,12 @@ const Expression = ({
: {}
),
...(
vararg || (isLast && !isFirst)
vararg && isFirst
? {'...': {label: '', type: description.type}}
: {}
),
...(
isLast && !isFirst
? {'.': {label: '', type: description.type}}
: {}
),
@ -90,11 +95,11 @@ const Expression = ({
}}
key={opPath}
onChange={((i) => (event, value, localPath) => {
if ('.' === value) {
if (0 === value.indexOf('.')) {
const parts = localPath.split('/');
parts.pop();
parts.pop();
if (vararg) {
if ('...' === value) {
parts.pop();
patch({
op: 'remove',

View File

@ -20,7 +20,7 @@ const Invocation = ({
return (
<Key
childrenDescription={{
'.': {label: '', type: 'undefined'},
'...': {label: '', type: 'undefined'},
'[literal]': {label: '', type: 'undefined'},
...context.describe().children,
'[key]': {label: '', type: 'undefined'},
@ -54,7 +54,7 @@ const Invocation = ({
}
}}
path={argPath}
value="."
value="..."
/>
);
}