fix(browser): distinguish computed call keys from identifiers (#808)
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
@@ -11,7 +11,11 @@ export const calleeName = (callee: t.Node): string => {
|
||||
const object = t.isExpression(callee.object)
|
||||
? calleeName(callee.object)
|
||||
: "";
|
||||
const property = propertyName(callee.property);
|
||||
const property = semanticStaticPropertyName(
|
||||
callee.property,
|
||||
callee.computed,
|
||||
);
|
||||
if (property === "") return "";
|
||||
return object === "" ? property : `${object}.${property}`;
|
||||
}
|
||||
return "";
|
||||
@@ -21,12 +25,6 @@ export const stringArgument = (
|
||||
value: t.Node | null | undefined,
|
||||
): string | undefined => (t.isStringLiteral(value) ? value.value : undefined);
|
||||
|
||||
export const propertyName = (value: t.Node): string => {
|
||||
if (t.isIdentifier(value)) return value.name;
|
||||
if (t.isStringLiteral(value)) return value.value;
|
||||
return "";
|
||||
};
|
||||
|
||||
export const objectValue = (
|
||||
object: t.ObjectExpression,
|
||||
name: string,
|
||||
|
||||
Reference in New Issue
Block a user