Refactoring. Create WrappedType.

This commit is contained in:
Stanislav Erokhin
2016-05-24 17:36:45 +03:00
parent 957bae18be
commit 7bc2c55d12
11 changed files with 128 additions and 128 deletions
@@ -99,9 +99,11 @@ class TypeResolver(
if (!c.allowBareTypes && !c.forceResolveLazyTypes && lazinessToken.isLazy()) {
// Bare types can be allowed only inside expressions; lazy type resolution is only relevant for declarations
class LazyKotlinType : DelegatingType(), LazyEntity {
class LazyKotlinType : WrappedType(), LazyEntity {
private val _delegate = storageManager.createLazyValue { doResolvePossiblyBareType(c, typeReference).getActualType() }
override fun getDelegate() = _delegate()
override fun unwrap() = _delegate()
override fun isComputed() = _delegate.isComputed()
override fun forceResolveAllContents() {
ForceResolveUtil.forceResolveAllContents(constructor)
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
import static org.jetbrains.kotlin.resolve.BindingContext.DEFERRED_TYPE;
public class DeferredType extends DelegatingType implements LazyType {
public class DeferredType extends WrappedType implements LazyType {
private static final Function1 EMPTY_CONSUMER = new Function1<Object, Void>() {
@Override
@@ -81,15 +81,18 @@ public class DeferredType extends DelegatingType implements LazyType {
return lazyValue.isComputing();
}
@Override
public boolean isComputed() {
return lazyValue.isComputed();
}
@NotNull
@Override
public KotlinType getDelegate() {
public KotlinType unwrap() {
return lazyValue.invoke();
}
@NotNull
@Override
public String toString() {
try {