/**
* @param {any} primaryPrefixAst
* @param {any} primarySuffixAst
*/
function handleNoMethodInvocationSuffix(primaryPrefixAst: any, primarySuffixAst: any) { // --------------------------------------- +0.5 Complexity index (+0.5 atomic)
if (primarySuffixAst.length === 1 && primarySuffixAst[0].kind === 'ClassLiteralSuffix') { // --------------------------------- +3.2 Complexity index (+1.2 atomic, +2 structural)
primaryPrefixAst.push(...primarySuffixAst.pop().children) // ------------------------------------------------------------- +2.5 Complexity index (+0.5 atomic, +2 structural)
}
if (primaryPrefixAst.length > 1) { // ---------------------------------------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
return [ // -------------------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
toPropertyAccessExpression(primaryPrefixAst, false, []), // ---------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
...primarySuffixAst // ----------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
];
}
if (primaryPrefixAst.length === 1 && primaryPrefixAst[0].kind === 'ThisKeyword') { // ---------------------------------------- +3.2 Complexity index (+1.2 atomic, +2 structural)
return [ // -------------------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
toPropertyAccessExpression([...primaryPrefixAst, ...primarySuffixAst], false, []), // -------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
];
}
if (primarySuffixAst.every(e => e.kind === 'Identifier') && primarySuffixAst.every(e => e.kind === 'Identifier')) { // ------- +8.9 Complexity index (+1.9 atomic, +1 nesting, +6 structural)
return [ // -------------------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
toPropertyAccessExpression([...primaryPrefixAst, ...primarySuffixAst], false, []), // -------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
];
}
return [ // ------------------------------------------------------------------------------------------------------------------ +0.1 Complexity index (+0.1 atomic)
...primaryPrefixAst, // -------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
...primarySuffixAst // --------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
];
}
|