Introduce interface method: VariableDescriptor.isConst

And several default implementations
Also take it into account in renderer
This commit is contained in:
Denis Zharkov
2015-09-21 16:30:11 +03:00
parent 02b64ce1ed
commit bde58d6eb8
13 changed files with 52 additions and 16 deletions
@@ -57,7 +57,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
) {
super(containingDeclaration, null, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
original.isVar(), Name.identifier("access$" + getIndexedAccessorSuffix(original, index)),
Kind.DECLARATION, SourceElement.NO_SOURCE, false);
Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false);
this.calleeDescriptor = original;
this.accessorIndex = index;
@@ -261,7 +261,8 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp
kind: CallableMemberDescriptor.Kind,
source: SourceElement
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(containingDeclaration, original, annotations,
modality, visibility, isVar, name, kind, source, false) {
modality, visibility, isVar, name, kind, source,
/* lateInit = */ false, /* isConst = */ false) {
override var getMethod: FunctionDescriptor by Delegates.notNull()
private set
@@ -645,7 +645,8 @@ public class DescriptorResolver {
JetPsiUtil.safeName(variable.getName()),
CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(variable),
false
/* lateInit = */ false,
/* isConst = */ false
);
// For a local variable the type must not be deferred
type = getVariableType(propertyDescriptor, scope, variable, dataFlowInfo, false, trace);
@@ -743,7 +744,8 @@ public class DescriptorResolver {
JetPsiUtil.safeName(property.getName()),
CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(property),
modifierList != null && modifierList.hasModifier(JetTokens.LATE_INIT_KEYWORD)
modifierList != null && modifierList.hasModifier(JetTokens.LATE_INIT_KEYWORD),
modifierList != null && modifierList.hasModifier(JetTokens.CONST_KEYWORD)
);
wrapper.setProperty(propertyDescriptor);
@@ -1114,7 +1116,8 @@ public class DescriptorResolver {
name,
CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(parameter),
false
/* lateInit = */ false,
/* isConst = */ false
);
propertyWrapper.setProperty(propertyDescriptor);
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
@@ -95,7 +95,8 @@ object DynamicCallableDescriptors {
name,
CallableMemberDescriptor.Kind.DECLARATION,
SourceElement.NO_SOURCE,
false
/* lateInit = */ false,
/* isConst = */ false
)
propertyDescriptor.setType(
DynamicType,
@@ -61,4 +61,6 @@ public class FakeCallableDescriptorForObject(
override fun getCompileTimeInitializer() = null
override fun getSource(): SourceElement = classDescriptor.getSource()
override fun isConst(): Boolean = false
}
@@ -93,7 +93,8 @@ public class LazyScriptClassMemberScope protected constructor(
Name.identifier(ScriptDescriptor.LAST_EXPRESSION_VALUE_FIELD_NAME),
CallableMemberDescriptor.Kind.DECLARATION,
SourceElement.NO_SOURCE,
false
/* lateInit = */ false,
/* isConst = */ false
)
val returnType = scriptDescriptor.getScriptCodeDescriptor().getReturnType()
@@ -134,7 +135,8 @@ public class LazyScriptClassMemberScope protected constructor(
parameter.getName(),
CallableMemberDescriptor.Kind.DECLARATION,
SourceElement.NO_SOURCE,
false
/* lateInit = */ false,
/* isConst = */ false
)
propertyDescriptor.setType(
parameter.getType(),