TS: Support readonly type expressions

This commit is contained in:
Asger F
2019-04-10 12:26:46 +01:00
parent 11f460c6a3
commit d5ae69d40a
7 changed files with 30 additions and 2 deletions

View File

@@ -970,6 +970,14 @@ class RestTypeExpr extends @resttypeexpr, TypeExpr {
TypeExpr getElementType() { result = getArrayType().(ArrayTypeExpr).getElementType() }
}
/**
* A type of form `readonly T`, such as `readonly number[]`.
*/
class ReadonlyTypeExpr extends @readonlytypeexpr, TypeExpr {
/** Gets the type `T` in `readonly T`. */
TypeExpr getElementType() { result = getChildTypeExpr(0) }
}
/**
* A possibly qualified name that refers to a variable from inside a type.
*

View File

@@ -573,6 +573,7 @@ case @typeexpr.kind of
| 33 = @optionaltypeexpr
| 34 = @resttypeexpr
| 35 = @bigintliteraltypeexpr
| 36 = @readonlytypeexpr
;
@typeref = @typeaccess | @typedecl;