Skip to content

Commit e8841e6

Browse files
committed
Simplify getSynthChild
1 parent f8b9929 commit e8841e6

1 file changed

Lines changed: 45 additions & 83 deletions

File tree

  • ql/src/codeql_ruby/ast/internal

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

Lines changed: 45 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -425,89 +425,51 @@ private module Cached {
425425
/** Gets the `i`th synthesized child of `parent`. */
426426
cached
427427
AST::AstNode getSynthChild(AST::AstNode parent, int i) {
428-
exists(SynthKind kind | mkSynthChild(kind, parent, i) |
429-
kind = AddExprKind() and
430-
result = TAddExprSynth(parent, i)
431-
or
432-
kind = AssignExprKind() and
433-
result = TAssignExprSynth(parent, i)
434-
or
435-
kind = BitwiseAndExprKind() and
436-
result = TBitwiseAndExprSynth(parent, i)
437-
or
438-
kind = BitwiseOrExprKind() and
439-
result = TBitwiseOrExprSynth(parent, i)
440-
or
441-
kind = BitwiseXorExprKind() and
442-
result = TBitwiseXorExprSynth(parent, i)
443-
or
444-
exists(AST::ClassVariable v |
445-
kind = ClassVariableAccessKind(v) and
446-
result = TClassVariableAccessSynth(parent, i, v)
447-
)
448-
or
449-
kind = DivExprKind() and
450-
result = TDivExprSynth(parent, i)
451-
or
452-
kind = ElementReferenceKind() and
453-
result = TElementReferenceSynth(parent, i)
454-
or
455-
kind = ExponentExprKind() and
456-
result = TExponentExprSynth(parent, i)
457-
or
458-
exists(AST::GlobalVariable v |
459-
kind = GlobalVariableAccessKind(v) and
460-
result = TGlobalVariableAccessSynth(parent, i, v)
461-
)
462-
or
463-
exists(AST::InstanceVariable v |
464-
kind = InstanceVariableAccessKind(v) and
465-
result = TInstanceVariableAccessSynth(parent, i, v)
466-
)
467-
or
468-
exists(int value |
469-
kind = IntegerLiteralKind(value) and
470-
result = TIntegerLiteralSynth(parent, i, value)
471-
)
472-
or
473-
kind = LShiftExprKind() and
474-
result = TLShiftExprSynth(parent, i)
475-
or
476-
exists(AST::LocalVariable v | result = TLocalVariableAccessSynth(parent, i, v) |
477-
kind = LocalVariableAccessRealKind(v)
478-
or
479-
kind = LocalVariableAccessSynthKind(v)
480-
)
481-
or
482-
kind = LogicalAndExprKind() and
483-
result = TLogicalAndExprSynth(parent, i)
484-
or
485-
kind = LogicalOrExprKind() and
486-
result = TLogicalOrExprSynth(parent, i)
487-
or
488-
exists(string name |
489-
kind = MethodCallKind(name) and
490-
result = TMethodCallSynth(parent, i, name)
491-
)
492-
or
493-
kind = ModuloExprKind() and
494-
result = TModuloExprSynth(parent, i)
495-
or
496-
kind = MulExprKind() and
497-
result = TMulExprSynth(parent, i)
498-
or
499-
kind = RShiftExprKind() and
500-
result = TRShiftExprSynth(parent, i)
501-
or
502-
kind = SelfKind() and
503-
result = TSelfSynth(parent, i)
504-
or
505-
kind = StmtSequenceKind() and
506-
result = TStmtSequenceSynth(parent, i)
507-
or
508-
kind = SubExprKind() and
509-
result = TSubExprSynth(parent, i)
510-
)
428+
result = TAddExprSynth(parent, i)
429+
or
430+
result = TAssignExprSynth(parent, i)
431+
or
432+
result = TBitwiseAndExprSynth(parent, i)
433+
or
434+
result = TBitwiseOrExprSynth(parent, i)
435+
or
436+
result = TBitwiseXorExprSynth(parent, i)
437+
or
438+
result = TClassVariableAccessSynth(parent, i, _)
439+
or
440+
result = TDivExprSynth(parent, i)
441+
or
442+
result = TElementReferenceSynth(parent, i)
443+
or
444+
result = TExponentExprSynth(parent, i)
445+
or
446+
result = TGlobalVariableAccessSynth(parent, i, _)
447+
or
448+
result = TInstanceVariableAccessSynth(parent, i, _)
449+
or
450+
result = TIntegerLiteralSynth(parent, i, _)
451+
or
452+
result = TLShiftExprSynth(parent, i)
453+
or
454+
result = TLocalVariableAccessSynth(parent, i, _)
455+
or
456+
result = TLogicalAndExprSynth(parent, i)
457+
or
458+
result = TLogicalOrExprSynth(parent, i)
459+
or
460+
result = TMethodCallSynth(parent, i, _)
461+
or
462+
result = TModuloExprSynth(parent, i)
463+
or
464+
result = TMulExprSynth(parent, i)
465+
or
466+
result = TRShiftExprSynth(parent, i)
467+
or
468+
result = TSelfSynth(parent, i)
469+
or
470+
result = TStmtSequenceSynth(parent, i)
471+
or
472+
result = TSubExprSynth(parent, i)
511473
}
512474

513475
/**

0 commit comments

Comments
 (0)