File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -460,7 +460,17 @@ codeql::UnresolvedMemberExpr ExprTranslator::translateUnresolvedMemberExpr(
460
460
461
461
codeql::SequenceExpr ExprTranslator::translateSequenceExpr (const swift::SequenceExpr& expr) {
462
462
auto entry = createExprEntry (expr);
463
- entry.elements = dispatcher.fetchRepeatedLabels (expr.getElements ());
463
+ // SequenceExpr represents a flat tree of expressions with elements at odd indices being the
464
+ // parents of the elements with even indices, so we only extract the "parent" elements here. In
465
+ // case there is a single child, we extract it as a parent. See
466
+ // https://github.com/github/codeql/pull/14119 and commit message for more details.
467
+ if (expr.getNumElements () == 1 ) {
468
+ entry.elements = dispatcher.fetchRepeatedLabels (expr.getElements ());
469
+ } else {
470
+ for (int i = 1 ; i < expr.getNumElements (); i += 2 ) {
471
+ entry.elements .emplace_back (dispatcher.fetchLabel (expr.getElement (i)));
472
+ }
473
+ }
464
474
return entry;
465
475
}
466
476
You can’t perform that action at this time.
0 commit comments