FIR2IR: isExpect
This commit is contained in:
+30
-14
@@ -133,11 +133,20 @@ class Fir2IrDeclarationStorage(
|
|||||||
return regularClass.convertWithOffsets { startOffset, endOffset ->
|
return regularClass.convertWithOffsets { startOffset, endOffset ->
|
||||||
irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality) { symbol ->
|
irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality) { symbol ->
|
||||||
IrClassImpl(
|
IrClassImpl(
|
||||||
startOffset, endOffset, origin, symbol,
|
startOffset,
|
||||||
regularClass.name, regularClass.classKind,
|
endOffset,
|
||||||
regularClass.visibility, modality,
|
origin,
|
||||||
regularClass.isCompanion, regularClass.isInner,
|
symbol,
|
||||||
regularClass.isData, false, regularClass.isInline
|
regularClass.name,
|
||||||
|
regularClass.classKind,
|
||||||
|
regularClass.visibility,
|
||||||
|
modality,
|
||||||
|
isCompanion = regularClass.isCompanion,
|
||||||
|
isInner = regularClass.isInner,
|
||||||
|
isData = regularClass.isData,
|
||||||
|
isExternal = regularClass.isExternal,
|
||||||
|
isInline = regularClass.isInline,
|
||||||
|
isExpect = regularClass.isExpect
|
||||||
).apply {
|
).apply {
|
||||||
descriptor.bind(this)
|
descriptor.bind(this)
|
||||||
if (setParent) {
|
if (setParent) {
|
||||||
@@ -183,7 +192,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
startOffset, endOffset, origin, symbol,
|
startOffset, endOffset, origin, symbol,
|
||||||
Name.special("<no name provided>"), anonymousObject.classKind,
|
Name.special("<no name provided>"), anonymousObject.classKind,
|
||||||
Visibilities.LOCAL, modality,
|
Visibilities.LOCAL, modality,
|
||||||
isCompanion = false, isInner = false, isData = false, isExternal = false, isInline = false
|
isCompanion = false, isInner = false, isData = false, isExternal = false, isInline = false, isExpect = false
|
||||||
).apply {
|
).apply {
|
||||||
descriptor.bind(this)
|
descriptor.bind(this)
|
||||||
declareThisReceiver()
|
declareThisReceiver()
|
||||||
@@ -350,8 +359,11 @@ class Fir2IrDeclarationStorage(
|
|||||||
startOffset, endOffset, origin, symbol,
|
startOffset, endOffset, origin, symbol,
|
||||||
function.name, function.visibility, function.modality!!,
|
function.name, function.visibility, function.modality!!,
|
||||||
function.returnTypeRef.toIrType(session, this),
|
function.returnTypeRef.toIrType(session, this),
|
||||||
function.isInline, function.isExternal,
|
isInline = function.isInline,
|
||||||
function.isTailRec, function.isSuspend
|
isExternal = function.isExternal,
|
||||||
|
isTailrec = function.isTailRec,
|
||||||
|
isSuspend = function.isSuspend,
|
||||||
|
isExpect = function.isExpect
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.bindAndDeclareParameters(function, descriptor, irParent, isStatic = function.isStatic, shouldLeaveScope = shouldLeaveScope)
|
}.bindAndDeclareParameters(function, descriptor, irParent, isStatic = function.isStatic, shouldLeaveScope = shouldLeaveScope)
|
||||||
@@ -388,7 +400,8 @@ class Fir2IrDeclarationStorage(
|
|||||||
function.returnTypeRef.toIrType(session, this),
|
function.returnTypeRef.toIrType(session, this),
|
||||||
isInline = false, isExternal = false, isTailrec = false,
|
isInline = false, isExternal = false, isTailrec = false,
|
||||||
// TODO: suspend lambda
|
// TODO: suspend lambda
|
||||||
isSuspend = false
|
isSuspend = false,
|
||||||
|
isExpect = false
|
||||||
)
|
)
|
||||||
}.bindAndDeclareParameters(
|
}.bindAndDeclareParameters(
|
||||||
function, descriptor, irParent = null, isStatic = false, shouldLeaveScope = false
|
function, descriptor, irParent = null, isStatic = false, shouldLeaveScope = false
|
||||||
@@ -411,7 +424,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
startOffset, endOffset, origin, symbol,
|
startOffset, endOffset, origin, symbol,
|
||||||
constructor.name, constructor.visibility,
|
constructor.name, constructor.visibility,
|
||||||
constructor.returnTypeRef.toIrType(session, this),
|
constructor.returnTypeRef.toIrType(session, this),
|
||||||
isInline = false, isExternal = false, isPrimary = isPrimary
|
isInline = false, isExternal = false, isPrimary = isPrimary, isExpect = false
|
||||||
).bindAndDeclareParameters(constructor, descriptor, irParent, isStatic = true, shouldLeaveScope = shouldLeaveScope)
|
).bindAndDeclareParameters(constructor, descriptor, irParent, isStatic = true, shouldLeaveScope = shouldLeaveScope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,7 +455,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
Name.special("<$prefix-${correspondingProperty.name}>"),
|
Name.special("<$prefix-${correspondingProperty.name}>"),
|
||||||
propertyAccessor?.visibility ?: correspondingProperty.visibility,
|
propertyAccessor?.visibility ?: correspondingProperty.visibility,
|
||||||
correspondingProperty.modality, accessorReturnType,
|
correspondingProperty.modality, accessorReturnType,
|
||||||
isInline = false, isExternal = false, isTailrec = false, isSuspend = false
|
isInline = false, isExternal = false, isTailrec = false, isSuspend = false, isExpect = false
|
||||||
).apply {
|
).apply {
|
||||||
if (propertyAccessor == null && isSetter) {
|
if (propertyAccessor == null && isSetter) {
|
||||||
declareDefaultSetterParameter(propertyType)
|
declareDefaultSetterParameter(propertyType)
|
||||||
@@ -474,10 +487,13 @@ class Fir2IrDeclarationStorage(
|
|||||||
IrPropertyImpl(
|
IrPropertyImpl(
|
||||||
startOffset, endOffset, origin, symbol,
|
startOffset, endOffset, origin, symbol,
|
||||||
property.name, property.visibility, property.modality!!,
|
property.name, property.visibility, property.modality!!,
|
||||||
property.isVar, property.isConst, property.isLateInit,
|
isVar = property.isVar,
|
||||||
property.delegate != null,
|
isConst = property.isConst,
|
||||||
|
isLateinit = property.isLateInit,
|
||||||
|
isDelegated = property.delegate != null,
|
||||||
// TODO
|
// TODO
|
||||||
isExternal = false
|
isExternal = false,
|
||||||
|
isExpect = property.isExpect
|
||||||
).apply {
|
).apply {
|
||||||
descriptor.bind(this)
|
descriptor.bind(this)
|
||||||
val type = property.returnTypeRef.toIrType(session, this@Fir2IrDeclarationStorage)
|
val type = property.returnTypeRef.toIrType(session, this@Fir2IrDeclarationStorage)
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
FILE fqName:<root> fileName:/expectClassInherited.kt
|
FILE fqName:<root> fileName:/expectClassInherited.kt
|
||||||
CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
CLASS CLASS name:A modality:ABSTRACT visibility:public [expect] superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||||
CONSTRUCTOR visibility:protected <> () returnType:<root>.A [primary]
|
CONSTRUCTOR visibility:protected <> () returnType:<root>.A [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public [expect] superTypes:[kotlin.Any]'
|
||||||
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:kotlin.Unit
|
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.A) returnType:kotlin.Unit
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||||
@@ -20,13 +20,13 @@ FILE fqName:<root> fileName:/expectClassInherited.kt
|
|||||||
overridden:
|
overridden:
|
||||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
CLASS CLASS name:B modality:OPEN visibility:public superTypes:[<root>.A]
|
CLASS CLASS name:B modality:OPEN visibility:public [expect] superTypes:[<root>.A]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||||
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.B [primary]
|
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.B [primary]
|
||||||
VALUE_PARAMETER name:i index:0 type:kotlin.Int
|
VALUE_PARAMETER name:i index:0 type:kotlin.Int
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[<root>.A]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public [expect] superTypes:[<root>.A]'
|
||||||
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.B) returnType:kotlin.Unit
|
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.B) returnType:kotlin.Unit
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||||
FUN name:bar visibility:public modality:OPEN <> ($this:<root>.B, s:kotlin.String) returnType:kotlin.Unit
|
FUN name:bar visibility:public modality:OPEN <> ($this:<root>.B, s:kotlin.String) returnType:kotlin.Unit
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
FILE fqName:<root> fileName:/expectedEnumClass.kt
|
FILE fqName:<root> fileName:/expectedEnumClass.kt
|
||||||
CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum]
|
CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public [expect] superTypes:[kotlin.Enum]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum
|
||||||
CONSTRUCTOR visibility:private <> () returnType:<root>.MyEnum [primary]
|
CONSTRUCTOR visibility:private <> () returnType:<root>.MyEnum [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum'
|
||||||
<E>: <none>
|
<E>: <none>
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public [expect] superTypes:[kotlin.Enum]'
|
||||||
CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:public superTypes:[kotlin.Any]
|
CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.FOO
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.FOO
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.MyEnum.FOO [primary]
|
CONSTRUCTOR visibility:public <> () returnType:<root>.MyEnum.FOO [primary]
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
FILE fqName:<root> fileName:/expectedSealedClass.kt
|
FILE fqName:<root> fileName:/expectedSealedClass.kt
|
||||||
CLASS CLASS name:Ops modality:SEALED visibility:public superTypes:[kotlin.Any]
|
CLASS CLASS name:Ops modality:SEALED visibility:public [expect] superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Ops
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Ops
|
||||||
CONSTRUCTOR visibility:private <> () returnType:<root>.Ops [primary]
|
CONSTRUCTOR visibility:private <> () returnType:<root>.Ops [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Ops modality:SEALED visibility:public superTypes:[kotlin.Any]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Ops modality:SEALED visibility:public [expect] superTypes:[kotlin.Any]'
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||||
overridden:
|
overridden:
|
||||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||||
@@ -18,12 +18,12 @@ FILE fqName:<root> fileName:/expectedSealedClass.kt
|
|||||||
overridden:
|
overridden:
|
||||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
CLASS CLASS name:Add modality:FINAL visibility:public superTypes:[<root>.Ops]
|
CLASS CLASS name:Add modality:FINAL visibility:public [expect] superTypes:[<root>.Ops]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Add
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Add
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Add [primary]
|
CONSTRUCTOR visibility:public <> () returnType:<root>.Add [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Add modality:FINAL visibility:public superTypes:[<root>.Ops]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Add modality:FINAL visibility:public [expect] superTypes:[<root>.Ops]'
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||||
overridden:
|
overridden:
|
||||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||||
|
|||||||
Reference in New Issue
Block a user