Repeat Steps
Repeat Steps are CPGQL Steps which repeat another traversal multiple times.
repeat..times
ocular> cpg.method.name("main").repeat(_.astChildren).times(4).l
res123: List[AstNode] = List(
Call(
id -> 13L,
code -> "argc > 1",
name -> "<operator>.greaterThan",
// ...output trimmed for brevity
),
Call(
id -> 16L,
code -> "strcmp(argv[1], \"42\") == 0",
name -> "<operator>.equals",
// ...output trimmed for brevity
),
Call(
id -> 24L,
code -> "fprintf(stderr, \"It depends!\\n\")",
name -> "fprintf",
// ...output trimmed for brevity
),
Call(
id -> 27L,
code -> "exit(42)",
name -> "exit",
// ...output trimmed for brevity
)
)repeat..until
repeat..emit..times
repeat..emit..until
Last updated
Was this helpful?