fix(session-query): checkpoint review round 3
This commit is contained in:
@@ -531,7 +531,7 @@ function collectEventRelations(): Map<string, EventRelation> {
|
||||
const visit = (node: ts.Node): void => {
|
||||
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
|
||||
const method = node.expression.name.text
|
||||
if (!isCordisContextReceiver(node.expression, sf)) {
|
||||
if (!isCordisContextReceiver(node.expression)) {
|
||||
ts.forEachChild(node, visit)
|
||||
return
|
||||
}
|
||||
@@ -561,9 +561,12 @@ function collectEventRelations(): Map<string, EventRelation> {
|
||||
return out
|
||||
}
|
||||
|
||||
function isCordisContextReceiver(expr: ts.PropertyAccessExpression, sf: ts.SourceFile): boolean {
|
||||
const target = expr.expression.getText(sf)
|
||||
return target === 'ctx' || target === 'this.ctx'
|
||||
function isCordisContextReceiver(expr: ts.PropertyAccessExpression): boolean {
|
||||
const receiver = expr.expression
|
||||
if (ts.isIdentifier(receiver)) return receiver.text === 'ctx' || receiver.text === '_ctx'
|
||||
return ts.isPropertyAccessExpression(receiver)
|
||||
&& receiver.expression.kind === ts.SyntaxKind.ThisKeyword
|
||||
&& (receiver.name.text === 'ctx' || receiver.name.text === '_ctx')
|
||||
}
|
||||
|
||||
function eventArg(args: ts.NodeArray<ts.Expression>, method: string): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user