Kotlin: Autoformat QL

This commit is contained in:
Ian Lynagh
2022-03-23 18:03:55 +00:00
parent c5e3aefe10
commit 77fec17a36
51 changed files with 316 additions and 243 deletions

View File

@@ -40,10 +40,14 @@ class Compilation extends @compilation {
predicate fileCompiledSuccessful(int i) { compilation_compiling_files_completed(this, i, 0) }
/** Holds if the `i`th file during this invocation had recoverable extraction errors. */
predicate fileCompiledRecoverableErrors(int i) { compilation_compiling_files_completed(this, i, 1) }
predicate fileCompiledRecoverableErrors(int i) {
compilation_compiling_files_completed(this, i, 1)
}
/** Holds if the `i`th file during this invocation had non-recoverable extraction errors. */
predicate fileCompiledNonRecoverableErrors(int i) { compilation_compiling_files_completed(this, i, 2) }
predicate fileCompiledNonRecoverableErrors(int i) {
compilation_compiling_files_completed(this, i, 2)
}
/**
* Gets the amount of CPU time spent processing file number `i` in the

View File

@@ -4,31 +4,32 @@
import java
class KotlinType extends Element, @kt_type {
}
class KotlinType extends Element, @kt_type { }
class KotlinNullableType extends KotlinType, @kt_nullable_type {
override string toString() {
exists(RefType javaType |
kt_nullable_types(this, javaType) and
result = "Kotlin nullable " + javaType.toString())
kt_nullable_types(this, javaType) and
result = "Kotlin nullable " + javaType.toString()
)
}
override string getAPrimaryQlClass() { result = "KotlinNullableType" }
}
class KotlinNotnullType extends KotlinType, @kt_notnull_type {
override string toString() {
exists(RefType javaType |
kt_notnull_types(this, javaType) and
result = "Kotlin not-null " + javaType.toString())
kt_notnull_types(this, javaType) and
result = "Kotlin not-null " + javaType.toString()
)
}
override string getAPrimaryQlClass() { result = "KotlinNotnullType" }
}
class KotlinTypeAlias extends Element, @kt_type_alias {
override string getAPrimaryQlClass() { result = "KotlinTypeAlias" }
KotlinType getKotlinType() {
kt_type_alias(this, _, result)
}
KotlinType getKotlinType() { kt_type_alias(this, _, result) }
}

View File

@@ -273,9 +273,7 @@ private class PpCastExpr extends PpAst, CastExpr {
}
private class PpSafeCastExpr extends PpAst, SafeCastExpr {
override string getPart(int i) {
i = 1 and result = "as?"
}
override string getPart(int i) { i = 1 and result = "as?" }
override PpAst getChild(int i) {
i = 0 and result = this.getExpr()
@@ -285,21 +283,15 @@ private class PpSafeCastExpr extends PpAst, SafeCastExpr {
}
private class PpImplicitCastExpr extends PpAst, ImplicitCastExpr {
override PpAst getChild(int i) {
i = 0 and result = this.getExpr()
}
override PpAst getChild(int i) { i = 0 and result = this.getExpr() }
}
private class PpImplicitNotNullExpr extends PpAst, ImplicitNotNullExpr {
override PpAst getChild(int i) {
i = 0 and result = this.getExpr()
}
override PpAst getChild(int i) { i = 0 and result = this.getExpr() }
}
private class PpImplicitCoercionToUnitExpr extends PpAst, ImplicitCoercionToUnitExpr {
override PpAst getChild(int i) {
i = 0 and result = this.getExpr()
}
override PpAst getChild(int i) { i = 0 and result = this.getExpr() }
}
private class PpCall extends PpAst, Call {

View File

@@ -700,14 +700,10 @@ class Class extends ClassOrInterface, @class {
/** A Kotlin `object`. */
class ClassObject extends Class {
ClassObject() {
class_object(this, _)
}
ClassObject() { class_object(this, _) }
/** Gets the instance variable that implements this `object`. */
Field getInstance() {
class_object(this, result)
}
Field getInstance() { class_object(this, result) }
}
/** A Kotlin `companion object`. */