Introduce cast for <unsafe-coerce> calls

This commit is contained in:
Tamas Vajk
2022-01-25 13:45:54 +01:00
committed by Ian Lynagh
parent 8d754f5129
commit b4beddf2f9
3 changed files with 33 additions and 1 deletions

View File

@@ -747,6 +747,7 @@ case @expr.kind of
| 83 = @stringtemplateexpr
| 84 = @varargexpr
| 85 = @notnullexpr
| 86 = @unsafecoerceexpr
;
/** Holds if this `when` expression was written as an `if` expression. */

View File

@@ -1144,7 +1144,8 @@ class CastingExpr extends Expr {
this instanceof @safecastexpr or
this instanceof @implicitcastexpr or
this instanceof @implicitnotnullexpr or
this instanceof @implicitcoerciontounitexpr
this instanceof @implicitcoerciontounitexpr or
this instanceof @unsafecoerceexpr
}
/** Gets the target type of this casting expression. */
@@ -1194,6 +1195,14 @@ class ImplicitCoercionToUnitExpr extends CastingExpr, @implicitcoerciontounitexp
override string getAPrimaryQlClass() { result = "ImplicitCoercionToUnitExpr" }
}
/** An unsafe coerce expression. */
class UnsafeCoerceExpr extends CastingExpr, @unsafecoerceexpr {
/** Gets a printable representation of this expression. */
override string toString() { result = "<unsafe coerce>" }
override string getAPrimaryQlClass() { result = "UnsafeCoerceExpr" }
}
/** A class instance creation expression. */
class ClassInstanceExpr extends Expr, ConstructorCall, @classinstancexpr {
/** Gets the number of arguments provided to the constructor of the class instance creation expression. */