Minor. Invert 'notLocal' boolean value parameter

- Mainly to avoid double negations (!notLocal)
- Also swap last parameters (to allow use of named arguments)
This commit is contained in:
Denis Zharkov
2016-11-14 18:09:59 +03:00
parent b5a6cbd188
commit 5e73dc4a4c
3 changed files with 11 additions and 11 deletions
@@ -816,7 +816,7 @@ public class DescriptorResolver {
LexicalScope scopeForInitializer = ScopeUtils.makeScopeForPropertyInitializer(scopeWithTypeParameters, propertyDescriptor); LexicalScope scopeForInitializer = ScopeUtils.makeScopeForPropertyInitializer(scopeWithTypeParameters, propertyDescriptor);
KotlinType typeIfKnown = variableTypeAndInitializerResolver.resolveTypeNullable( KotlinType typeIfKnown = variableTypeAndInitializerResolver.resolveTypeNullable(
propertyDescriptor, scopeForInitializer, propertyDescriptor, scopeForInitializer,
property, dataFlowInfo, true, trace property, dataFlowInfo, /* local = */ trace, false
); );
PropertyGetterDescriptorImpl getter = resolvePropertyGetterDescriptor( PropertyGetterDescriptorImpl getter = resolvePropertyGetterDescriptor(
@@ -149,10 +149,10 @@ class LocalVariableResolver(
/* isConst = */ false /* isConst = */ false
) )
// For a local variable the type must not be deferred // For a local variable the type must not be deferred
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, false, trace) type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
val receiverParameter = (containingDeclaration as ScriptDescriptor).thisAsReceiverParameter val receiverParameter = (containingDeclaration as ScriptDescriptor).thisAsReceiverParameter
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null as? KotlinType) propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null as KotlinType?)
initializeWithDefaultGetterSetter(propertyDescriptor) initializeWithDefaultGetterSetter(propertyDescriptor)
trace.record(BindingContext.VARIABLE, variable, propertyDescriptor) trace.record(BindingContext.VARIABLE, variable, propertyDescriptor)
result = propertyDescriptor result = propertyDescriptor
@@ -160,7 +160,7 @@ class LocalVariableResolver(
else { else {
val variableDescriptor = resolveLocalVariableDescriptorWithType(scope, variable, null, trace) val variableDescriptor = resolveLocalVariableDescriptorWithType(scope, variable, null, trace)
// For a local variable the type must not be deferred // For a local variable the type must not be deferred
type = variableTypeAndInitializerResolver.resolveType(variableDescriptor, scope, variable, dataFlowInfo, false, trace) type = variableTypeAndInitializerResolver.resolveType(variableDescriptor, scope, variable, dataFlowInfo, trace, local = true)
variableDescriptor.setOutType(type) variableDescriptor.setOutType(type)
result = variableDescriptor result = variableDescriptor
} }
@@ -53,12 +53,12 @@ class VariableTypeAndInitializerResolver(
scopeForInitializer: LexicalScope, scopeForInitializer: LexicalScope,
variable: KtVariableDeclaration, variable: KtVariableDeclaration,
dataFlowInfo: DataFlowInfo, dataFlowInfo: DataFlowInfo,
notLocal: Boolean, trace: BindingTrace,
trace: BindingTrace local: Boolean
): KotlinType { ): KotlinType {
resolveTypeNullable(variableDescriptor, scopeForInitializer, variable, dataFlowInfo, notLocal, trace)?.let { return it } resolveTypeNullable(variableDescriptor, scopeForInitializer, variable, dataFlowInfo, trace, local)?.let { return it }
if (!notLocal) { if (local) {
trace.report(VARIABLE_WITH_NO_TYPE_NO_INITIALIZER.on(variable)) trace.report(VARIABLE_WITH_NO_TYPE_NO_INITIALIZER.on(variable))
} }
@@ -70,8 +70,8 @@ class VariableTypeAndInitializerResolver(
scopeForInitializer: LexicalScope, scopeForInitializer: LexicalScope,
variable: KtVariableDeclaration, variable: KtVariableDeclaration,
dataFlowInfo: DataFlowInfo, dataFlowInfo: DataFlowInfo,
notLocal: Boolean, trace: BindingTrace,
trace: BindingTrace local: Boolean
): KotlinType? { ): KotlinType? {
val propertyTypeRef = variable.typeReference val propertyTypeRef = variable.typeReference
return when { return when {
@@ -82,7 +82,7 @@ class VariableTypeAndInitializerResolver(
resolveDelegatedPropertyType(variable, variableDescriptor, scopeForInitializer, dataFlowInfo, trace) resolveDelegatedPropertyType(variable, variableDescriptor, scopeForInitializer, dataFlowInfo, trace)
variable.hasInitializer() -> when { variable.hasInitializer() -> when {
notLocal -> !local ->
DeferredType.createRecursionIntolerant( DeferredType.createRecursionIntolerant(
storageManager, storageManager,
trace trace