Skip to content

Commit da9adfb

Browse files
committed
Improve performance of desugaring transformations
1 parent 57eee03 commit da9adfb

5 files changed

Lines changed: 330 additions & 248 deletions

File tree

ql/src/codeql_ruby/ast/internal/Call.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ predicate isScopeResolutionMethodCall(Generated::ScopeResolution g, Generated::I
1313
}
1414

1515
abstract class CallImpl extends Call {
16-
abstract Expr getArgumentImpl(int n);
16+
abstract AstNode getArgumentImpl(int n);
1717

1818
/**
1919
* It is not possible to define this predicate as
@@ -28,7 +28,7 @@ abstract class CallImpl extends Call {
2828
}
2929

3030
abstract class MethodCallImpl extends CallImpl, MethodCall {
31-
abstract Expr getReceiverImpl();
31+
abstract AstNode getReceiverImpl();
3232

3333
abstract string getMethodNameImpl();
3434
}
@@ -42,9 +42,9 @@ class MethodCallSynth extends MethodCallImpl, TMethodCallSynth {
4242
)
4343
}
4444

45-
final override Expr getReceiverImpl() { synthChild(this, 0, result) }
45+
final override AstNode getReceiverImpl() { synthChild(this, 0, result) }
4646

47-
final override Expr getArgumentImpl(int n) { synthChild(this, n + 1, result) and n >= 0 }
47+
final override AstNode getArgumentImpl(int n) { synthChild(this, n + 1, result) and n >= 0 }
4848

4949
final override int getNumberOfArgumentsImpl() { this = TMethodCallSynth(_, _, _, _, result) }
5050
}
@@ -56,7 +56,7 @@ class IdentifierMethodCall extends MethodCallImpl, TIdentifierMethodCall {
5656

5757
final override string getMethodNameImpl() { result = g.getValue() }
5858

59-
final override Self getReceiverImpl() { result = TSelfSynth(this, 0) }
59+
final override AstNode getReceiverImpl() { result = TSelfSynth(this, 0) }
6060

6161
final override Expr getArgumentImpl(int n) { none() }
6262

ql/src/codeql_ruby/ast/internal/Operation.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ private import AST
33
private import TreeSitter
44

55
class AssignmentImpl extends Operation, TAssignment {
6-
abstract Pattern getLeftOperandImpl();
6+
abstract AstNode getLeftOperandImpl();
77

8-
abstract Expr getRightOperandImpl();
8+
abstract AstNode getRightOperandImpl();
99
}
1010

1111
class AssignExprReal extends AssignmentImpl, AssignExpr, TAssignExprReal {
1212
private Generated::Assignment g;
1313

1414
AssignExprReal() { this = TAssignExprReal(g) }
1515

16-
final override Pattern getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
16+
final override AstNode getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
1717

18-
final override Expr getRightOperandImpl() { toGenerated(result) = g.getRight() }
18+
final override AstNode getRightOperandImpl() { toGenerated(result) = g.getRight() }
1919
}
2020

2121
class AssignExprSynth extends AssignmentImpl, AssignExpr, TAssignExprSynth {
22-
final override Pattern getLeftOperandImpl() { synthChild(this, 0, result) }
22+
final override AstNode getLeftOperandImpl() { synthChild(this, 0, result) }
2323

24-
final override Expr getRightOperandImpl() { synthChild(this, 1, result) }
24+
final override AstNode getRightOperandImpl() { synthChild(this, 1, result) }
2525
}
2626

2727
class AssignOperationImpl extends AssignmentImpl, AssignOperation {
28-
final override LhsExpr getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
28+
final override AstNode getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
2929

30-
final override Expr getRightOperandImpl() { toGenerated(result) = g.getRight() }
30+
final override AstNode getRightOperandImpl() { toGenerated(result) = g.getRight() }
3131
}

0 commit comments

Comments
 (0)