| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -346,7 +346,8 @@ open class KotlinFileExtractor( | |||
| 346 | 346 | // here. | |
| 347 | 347 | val instance = useObjectClassInstance(c) | |
| 348 | 348 | val type = useSimpleTypeClass(c, emptyList(), false) | |
| 349 | - tw.writeFields(instance.id, instance.name, type.javaResult.id, type.kotlinResult.id, id, instance.id) | ||
| 349 | + tw.writeFields(instance.id, instance.name, type.javaResult.id, id, instance.id) | ||
| 350 | + tw.writeFieldsKotlinType(instance.id, type.kotlinResult.id) | ||
| 350 | 351 | tw.writeHasLocation(instance.id, locId) | |
| 351 | 352 | addModifiers(instance.id, "public", "static", "final") | |
| 352 | 353 | @Suppress("UNCHECKED_CAST") | |
@@ -382,7 +383,8 @@ open class KotlinFileExtractor( | |||
| 382 | 383 | val instance = useCompanionObjectClassInstance(innerClass) | |
| 383 | 384 | if(instance != null) { | |
| 384 | 385 | val type = useSimpleTypeClass(innerClass, emptyList(), false) | |
| 385 | - tw.writeFields(instance.id, instance.name, type.javaResult.id, type.kotlinResult.id, innerId, instance.id) | ||
| 386 | + tw.writeFields(instance.id, instance.name, type.javaResult.id, innerId, instance.id) | ||
| 387 | + tw.writeFieldsKotlinType(instance.id, type.kotlinResult.id) | ||
| 386 | 388 | tw.writeHasLocation(instance.id, innerLocId) | |
| 387 | 389 | addModifiers(instance.id, "public", "static", "final") | |
| 388 | 390 | @Suppress("UNCHECKED_CAST") | |
@@ -614,7 +616,8 @@ open class KotlinFileExtractor( | |||
| 614 | 616 | ||
| 615 | 617 | private fun extractField(id: Label<out DbField>, name: String, type: IrType, parentId: Label<out DbReftype>, locId: Label<DbLocation>, visibility: DescriptorVisibility, errorElement: IrElement, isExternalDeclaration: Boolean): Label<out DbField> { | |
| 616 | 618 | val t = useType(type) | |
| 617 | - tw.writeFields(id, name, t.javaResult.id, t.kotlinResult.id, parentId, id) | ||
| 619 | + tw.writeFields(id, name, t.javaResult.id, parentId, id) | ||
| 620 | + tw.writeFieldsKotlinType(id, t.kotlinResult.id) | ||
| 618 | 621 | tw.writeHasLocation(id, locId) | |
| 619 | 622 | ||
| 620 | 623 | extractVisibility(errorElement, id, visibility) | |
@@ -694,7 +697,8 @@ open class KotlinFileExtractor( | |||
| 694 | 697 | logger.warnElement(Severity.ErrorSevere, "Enum entry parent class has type parameters: " + parent.name, ee) | |
| 695 | 698 | } else { | |
| 696 | 699 | val type = useSimpleTypeClass(parent, emptyList(), false) | |
| 697 | - tw.writeFields(id, ee.name.asString(), type.javaResult.id, type.kotlinResult.id, parentId, id) | ||
| 700 | + tw.writeFields(id, ee.name.asString(), type.javaResult.id, parentId, id) | ||
| 701 | + tw.writeFieldsKotlinType(id, type.kotlinResult.id) | ||
| 698 | 702 | val locId = tw.getLocation(ee) | |
| 699 | 703 | tw.writeHasLocation(id, locId) | |
| 700 | 704 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -392,7 +392,8 @@ open class KotlinUsesExtractor( | |||
| 392 | 392 | // array.length | |
| 393 | 393 | val length = tw.getLabelFor<DbField>("@\"field;{$it};length\"") | |
| 394 | 394 | val intTypeIds = useType(pluginContext.irBuiltIns.intType) | |
| 395 | - tw.writeFields(length, "length", intTypeIds.javaResult.id, intTypeIds.kotlinResult.id, it, length) | ||
| 395 | + tw.writeFields(length, "length", intTypeIds.javaResult.id, it, length) | ||
| 396 | + tw.writeFieldsKotlinType(length, intTypeIds.kotlinResult.id) | ||
| 396 | 397 | addModifiers(length, "public", "final") | |
| 397 | 398 | ||
| 398 | 399 | // Note we will only emit one `clone()` method per Java array type, so we choose `Array<C?>` as its Kotlin | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,8 @@ | |||
| 1 | 1 | import java | |
| 2 | 2 | ||
| 3 | 3 | predicate badKotlinType(Element e, int i) { | |
| 4 | - e = any(Expr expr | count(expr.getKotlinType()) = i) | ||
| 4 | + e = any(Expr expr | count(expr.getKotlinType()) = i) or | ||
| 5 | + e = any(Field f | count(f.getKotlinType()) = i) | ||
| 5 | 6 | } | |
| 6 | 7 | ||
| 7 | 8 | from Element e, int i | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -399,11 +399,15 @@ fields( | |||
| 399 | 399 | unique int id: @field, | |
| 400 | 400 | string nodeName: string ref, | |
| 401 | 401 | int typeid: @type ref, | |
| 402 | - int kttypeid: @kt_type ref, | ||
| 403 | 402 | int parentid: @reftype ref, | |
| 404 | 403 | int sourceid: @field ref | |
| 405 | 404 | ); | |
| 406 | 405 | ||
| 406 | + fieldsKotlinType( | ||
| 407 | + unique int id: @field ref, | ||
| 408 | + int kttypeid: @kt_type ref | ||
| 409 | + ) | ||
| 410 | + | ||
| 407 | 411 | constrs( | |
| 408 | 412 | unique int id: @constructor, | |
| 409 | 413 | string nodeName: string ref, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,7 @@ predicate hasName(Element e, string name) { | |||
| 20 | 20 | or | |
| 21 | 21 | methods(e, name, _, _, _, _, _) | |
| 22 | 22 | or | |
| 23 | - fields(e, name, _, _, _, _) | ||
| 23 | + fields(e, name, _, _, _) | ||
| 24 | 24 | or | |
| 25 | 25 | packages(e, name) | |
| 26 | 26 | or | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,7 @@ private predicate hasChildElement(Element parent, Element e) { | |||
| 63 | 63 | or | |
| 64 | 64 | params(e, _, _, _, parent, _) | |
| 65 | 65 | or | |
| 66 | - fields(e, _, _, _, parent, _) | ||
| 66 | + fields(e, _, _, parent, _) | ||
| 67 | 67 | or | |
| 68 | 68 | typeVars(e, _, _, _, parent) | |
| 69 | 69 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -613,13 +613,13 @@ class FieldDeclaration extends ExprParent, @fielddecl, Annotatable { | |||
| 613 | 613 | /** A class or instance field. */ | |
| 614 | 614 | class Field extends Member, ExprParent, @field, Variable { | |
| 615 | 615 | /** Gets the declared type of this field. */ | |
| 616 | - override Type getType() { fields(this, _, result, _, _, _) } | ||
| 616 | + override Type getType() { fields(this, _, result, _, _) } | ||
| 617 | 617 | ||
| 618 | 618 | /** Gets the Kotlin type of this field. */ | |
| 619 | - override KotlinType getKotlinType() { fields(this, _, _, result, _, _) } | ||
| 619 | + override KotlinType getKotlinType() { fieldsKotlinType(this, result) } | ||
| 620 | 620 | ||
| 621 | 621 | /** Gets the type in which this field is declared. */ | |
| 622 | - override RefType getDeclaringType() { fields(this, _, _, _, result, _) } | ||
| 622 | + override RefType getDeclaringType() { fields(this, _, _, result, _) } | ||
| 623 | 623 | ||
| 624 | 624 | /** | |
| 625 | 625 | * Gets the field declaration in which this field is declared. | |
@@ -649,7 +649,7 @@ class Field extends Member, ExprParent, @field, Variable { | |||
| 649 | 649 | * | |
| 650 | 650 | * For all other fields, the source declaration is the field itself. | |
| 651 | 651 | */ | |
| 652 | - Field getSourceDeclaration() { fields(this, _, _, _, _, result) } | ||
| 652 | + Field getSourceDeclaration() { fields(this, _, _, _, result) } | ||
| 653 | 653 | ||
| 654 | 654 | /** Holds if this field is the same as its source declaration. */ | |
| 655 | 655 | predicate isSourceDeclaration() { this.getSourceDeclaration() = this } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -319,7 +319,7 @@ predicate declaresMember(Type t, @member m) { | |||
| 319 | 319 | or | |
| 320 | 320 | constrs(m, _, _, _, _, t, _) | |
| 321 | 321 | or | |
| 322 | - fields(m, _, _, _, t, _) | ||
| 322 | + fields(m, _, _, t, _) | ||
| 323 | 323 | or | |
| 324 | 324 | enclInReftype(m, t) and | |
| 325 | 325 | // Since the type `@member` in the dbscheme includes all `@reftype`s, | |
@@ -1136,11 +1136,11 @@ class EnumType extends Class { | |||
| 1136 | 1136 | ||
| 1137 | 1137 | /** Gets the enum constant with the specified name. */ | |
| 1138 | 1138 | EnumConstant getEnumConstant(string name) { | |
| 1139 | - fields(result, _, _, _, this, _) and result.hasName(name) | ||
| 1139 | + fields(result, _, _, this, _) and result.hasName(name) | ||
| 1140 | 1140 | } | |
| 1141 | 1141 | ||
| 1142 | 1142 | /** Gets an enum constant declared in this enum type. */ | |
| 1143 | - EnumConstant getAnEnumConstant() { fields(result, _, _, _, this, _) } | ||
| 1143 | + EnumConstant getAnEnumConstant() { fields(result, _, _, this, _) } | ||
| 1144 | 1144 | ||
| 1145 | 1145 | override predicate isFinal() { | |
| 1146 | 1146 | // JLS 8.9: An enum declaration is implicitly `final` unless it contains | |
| Back | FazBrowse Home | New Git URL |
0 commit comments