mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Kotlin: Add support for varargs
This commit is contained in:
@@ -694,6 +694,7 @@ case @expr.kind of
|
||||
| 78 = @notinstanceofexpr
|
||||
| 79 = @stmtexpr
|
||||
| 80 = @stringtemplateexpr
|
||||
| 81 = @varargexpr
|
||||
;
|
||||
|
||||
/** Holds if this `when` expression was written as an `if` expression. */
|
||||
|
||||
@@ -2267,3 +2267,26 @@ class StringTemplateExpr extends Expr, @stringtemplateexpr {
|
||||
|
||||
override string getAPrimaryQlClass() { result = "StringTemplateExpr" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A Kotlin(TODO: Should Java make these too?) vararg expression.
|
||||
* This is the argument to a function that corresponds to a `vararg`
|
||||
* parameter.
|
||||
*/
|
||||
class VarArgExpr extends Expr, @varargexpr {
|
||||
/**
|
||||
* Gets the `i`th component of this vararg. TODO: Is this always Expr?
|
||||
*
|
||||
* For example, in the string template `"foo${bar}baz"`, the 0th
|
||||
* component is the string literal `"foo"`, the 1st component is
|
||||
* the variable access `bar`, and the 2nd component is the string
|
||||
* literal `"bar"`.
|
||||
*/
|
||||
Expr getComponent(int i) { result.isNthChildOf(this, i) }
|
||||
|
||||
override string toString() { result = "..." }
|
||||
|
||||
override string getHalsteadID() { result = "VarArgExpr" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "VarArgExpr" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user