From f6d9b194ede21d8b0a81f3c5c058fc3f38b3f584 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 31 Jan 2021 02:30:00 -0600 Subject: [PATCH] refactor: triple dot for vararg --- .../entity/src/behavior-components/expression.jsx | 11 ++++++++--- .../src/behavior-components/expression/invocation.jsx | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/entity/src/behavior-components/expression.jsx b/packages/entity/src/behavior-components/expression.jsx index a620c18..d507095 100644 --- a/packages/entity/src/behavior-components/expression.jsx +++ b/packages/entity/src/behavior-components/expression.jsx @@ -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', diff --git a/packages/entity/src/behavior-components/expression/invocation.jsx b/packages/entity/src/behavior-components/expression/invocation.jsx index 0c599d0..ca08104 100644 --- a/packages/entity/src/behavior-components/expression/invocation.jsx +++ b/packages/entity/src/behavior-components/expression/invocation.jsx @@ -20,7 +20,7 @@ const Invocation = ({ return ( ); }