IrTypes: fix multiple issues in psi2ir
This commit is contained in:
committed by
Dmitry Petrov
parent
35cf7c4db3
commit
f837537cb6
@@ -107,7 +107,7 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator
|
|||||||
val constructorSymbol = context.symbolTable.referenceConstructor(descriptor.original)
|
val constructorSymbol = context.symbolTable.referenceConstructor(descriptor.original)
|
||||||
val irCall = IrDelegatingConstructorCallImpl(
|
val irCall = IrDelegatingConstructorCallImpl(
|
||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
descriptor.returnType.toIrType(),
|
context.irBuiltIns.unitType,
|
||||||
constructorSymbol,
|
constructorSymbol,
|
||||||
descriptor
|
descriptor
|
||||||
).apply {
|
).apply {
|
||||||
|
|||||||
+1
-1
@@ -172,7 +172,7 @@ class DataClassMembersGenerator(
|
|||||||
for (property in properties) {
|
for (property in properties) {
|
||||||
val irPropertyType = property.type.toIrType()
|
val irPropertyType = property.type.toIrType()
|
||||||
val arg1 = irGet(irPropertyType, irThis(), getPropertyGetterSymbol(property))
|
val arg1 = irGet(irPropertyType, irThis(), getPropertyGetterSymbol(property))
|
||||||
val arg2 = irGet(irPropertyType, irGet(irPropertyType, otherWithCast.symbol), getPropertyGetterSymbol(property))
|
val arg2 = irGet(irPropertyType, irGet(irType, otherWithCast.symbol), getPropertyGetterSymbol(property))
|
||||||
+irIfThenReturnFalse(irNotEquals(arg1, arg2))
|
+irIfThenReturnFalse(irNotEquals(arg1, arg2))
|
||||||
}
|
}
|
||||||
+irReturnTrue()
|
+irReturnTrue()
|
||||||
|
|||||||
+3
-1
@@ -120,6 +120,7 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio
|
|||||||
): IrSimpleFunction =
|
): IrSimpleFunction =
|
||||||
declareSimpleFunctionInner(descriptor, ktParameter, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR).buildWithScope { irAccessor ->
|
declareSimpleFunctionInner(descriptor, ktParameter, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR).buildWithScope { irAccessor ->
|
||||||
declarationGenerator.generateScopedTypeParameterDeclarations(irAccessor, descriptor.typeParameters)
|
declarationGenerator.generateScopedTypeParameterDeclarations(irAccessor, descriptor.typeParameters)
|
||||||
|
irAccessor.returnType = descriptor.returnType!!.toIrType()
|
||||||
FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irAccessor)
|
FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irAccessor)
|
||||||
irAccessor.body = generateDefaultAccessorBody(ktParameter, descriptor, irAccessor)
|
irAccessor.body = generateDefaultAccessorBody(ktParameter, descriptor, irAccessor)
|
||||||
}
|
}
|
||||||
@@ -296,6 +297,7 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio
|
|||||||
context.symbolTable.declareValueParameter(
|
context.symbolTable.declareValueParameter(
|
||||||
ktElement.startOffsetOrUndefined, ktElement.endOffsetOrUndefined,
|
ktElement.startOffsetOrUndefined, ktElement.endOffsetOrUndefined,
|
||||||
IrDeclarationOrigin.DEFINED,
|
IrDeclarationOrigin.DEFINED,
|
||||||
descriptor, descriptor.type.toIrType()
|
descriptor, descriptor.type.toIrType(),
|
||||||
|
(descriptor as? ValueParameterDescriptor)?.varargElementType?.toIrType()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+3
-4
@@ -30,12 +30,11 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
|||||||
class GeneratorContext(
|
class GeneratorContext(
|
||||||
val configuration: Psi2IrConfiguration,
|
val configuration: Psi2IrConfiguration,
|
||||||
val moduleDescriptor: ModuleDescriptor,
|
val moduleDescriptor: ModuleDescriptor,
|
||||||
val bindingContext: BindingContext
|
val bindingContext: BindingContext,
|
||||||
) : IrGeneratorContext(IrBuiltIns(moduleDescriptor.builtIns)) {
|
val symbolTable: SymbolTable = SymbolTable()
|
||||||
|
) : IrGeneratorContext(IrBuiltIns(moduleDescriptor.builtIns, symbolTable)) {
|
||||||
val sourceManager = PsiSourceManager()
|
val sourceManager = PsiSourceManager()
|
||||||
|
|
||||||
val symbolTable = SymbolTable()
|
|
||||||
|
|
||||||
// TODO: inject a correct StorageManager instance, or store NotFoundClasses inside ModuleDescriptor
|
// TODO: inject a correct StorageManager instance, or store NotFoundClasses inside ModuleDescriptor
|
||||||
val reflectionTypes = ReflectionTypes(moduleDescriptor, NotFoundClasses(LockBasedStorageManager.NO_LOCKS, moduleDescriptor))
|
val reflectionTypes = ReflectionTypes(moduleDescriptor, NotFoundClasses(LockBasedStorageManager.NO_LOCKS, moduleDescriptor))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user