IrTypes: fix multiple issues in psi2ir

This commit is contained in:
Svyatoslav Scherbina
2018-05-30 13:21:17 +03:00
committed by Dmitry Petrov
parent 35cf7c4db3
commit f837537cb6
4 changed files with 8 additions and 7 deletions
@@ -107,7 +107,7 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator
val constructorSymbol = context.symbolTable.referenceConstructor(descriptor.original)
val irCall = IrDelegatingConstructorCallImpl(
startOffset, endOffset,
descriptor.returnType.toIrType(),
context.irBuiltIns.unitType,
constructorSymbol,
descriptor
).apply {
@@ -172,7 +172,7 @@ class DataClassMembersGenerator(
for (property in properties) {
val irPropertyType = property.type.toIrType()
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))
}
+irReturnTrue()
@@ -120,6 +120,7 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio
): IrSimpleFunction =
declareSimpleFunctionInner(descriptor, ktParameter, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR).buildWithScope { irAccessor ->
declarationGenerator.generateScopedTypeParameterDeclarations(irAccessor, descriptor.typeParameters)
irAccessor.returnType = descriptor.returnType!!.toIrType()
FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irAccessor)
irAccessor.body = generateDefaultAccessorBody(ktParameter, descriptor, irAccessor)
}
@@ -296,6 +297,7 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio
context.symbolTable.declareValueParameter(
ktElement.startOffsetOrUndefined, ktElement.endOffsetOrUndefined,
IrDeclarationOrigin.DEFINED,
descriptor, descriptor.type.toIrType()
descriptor, descriptor.type.toIrType(),
(descriptor as? ValueParameterDescriptor)?.varargElementType?.toIrType()
)
}
@@ -30,12 +30,11 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager
class GeneratorContext(
val configuration: Psi2IrConfiguration,
val moduleDescriptor: ModuleDescriptor,
val bindingContext: BindingContext
) : IrGeneratorContext(IrBuiltIns(moduleDescriptor.builtIns)) {
val bindingContext: BindingContext,
val symbolTable: SymbolTable = SymbolTable()
) : IrGeneratorContext(IrBuiltIns(moduleDescriptor.builtIns, symbolTable)) {
val sourceManager = PsiSourceManager()
val symbolTable = SymbolTable()
// TODO: inject a correct StorageManager instance, or store NotFoundClasses inside ModuleDescriptor
val reflectionTypes = ReflectionTypes(moduleDescriptor, NotFoundClasses(LockBasedStorageManager.NO_LOCKS, moduleDescriptor))
}