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