Highlight 'var' primary constructor parameters as mutable
#KT-11467 Fixed
This commit is contained in:
+5
-13
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.highlighter
|
||||
@@ -63,6 +52,9 @@ internal class PropertiesHighlightingVisitor(holder: AnnotationHolder, bindingCo
|
||||
val nameIdentifier = parameter.nameIdentifier ?: return
|
||||
val propertyDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter)
|
||||
if (propertyDescriptor != null) {
|
||||
if (propertyDescriptor.isVar) {
|
||||
highlightName(nameIdentifier, MUTABLE_VARIABLE)
|
||||
}
|
||||
highlightProperty(nameIdentifier, propertyDescriptor)
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -10,7 +10,11 @@ val <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">y</info> : <info textAttri
|
||||
return 5.<info textAttributesKey="KOTLIN_EXTENSION_PROPERTY">sq</info> + <info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE">field</info> + <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">x</info></info>
|
||||
}
|
||||
|
||||
class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info> : <info textAttributesKey="KOTLIN_CLASS">Int</info>, <info textAttributesKey="KOTLIN_PARAMETER">b</info> : <info textAttributesKey="KOTLIN_CLASS">String</info>) {
|
||||
class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(
|
||||
val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info> : <info textAttributesKey="KOTLIN_CLASS">Int</info>,
|
||||
<info textAttributesKey="KOTLIN_PARAMETER">b</info> : <info textAttributesKey="KOTLIN_CLASS">String</info>,
|
||||
var <info textAttributesKey="KOTLIN_MUTABLE_VARIABLE"><info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">c</info></info> : <info textAttributesKey="KOTLIN_CLASS">String</info>
|
||||
) {
|
||||
<info>init</info> {
|
||||
<info textAttributesKey="KOTLIN_PARAMETER">b</info>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user