Remove unnecessary error report from extract function

This commit is contained in:
Natalia Ukhorskaya
2014-05-19 20:03:00 +04:00
parent d263621ef5
commit 58b82baa2b
4 changed files with 1 additions and 7 deletions
@@ -316,7 +316,6 @@ private fun getFunctionForExtractedFragment(
ErrorMessage.SUPER_CALL -> "Cannot perform an action for expression with super call"
ErrorMessage.DENOTABLE_TYPES -> "Cannot perform an action because following types are unavailable from debugger scope"
ErrorMessage.MULTIPLE_OUTPUT -> "Cannot perform an action because this code fragment changes more than one variable"
ErrorMessage.NON_LOCAL_DECLARATION,
ErrorMessage.DECLARATIONS_OUT_OF_SCOPE,
ErrorMessage.OUTPUT_AND_EXIT_POINT,
ErrorMessage.MULTIPLE_EXIT_POINTS,
@@ -16,7 +16,6 @@ selected.code.fragment.has.output.values.and.exit.points=Selected code fragment
parameter.types.are.not.denotable=Cannot extract method since following types are not denotable in the target scope:
declarations.will.move.out.of.scope=Following declarations won't be available outside of extracted function body:
cannot.extract.super.call=Cannot extract super-call
cannot.extract.non.local.declaration.ref=Cannot extract reference to non-local declaration
cannot.refactor.expression.should.have.inferred.type=Expression should have inferred type
cannot.refactor.synthesized.function=Cannot refactor synthesized function ''{0}''
@@ -151,7 +151,6 @@ class AnalysisResult (
NO_EXPRESSION
NO_CONTAINER
SUPER_CALL
NON_LOCAL_DECLARATION
DENOTABLE_TYPES
MULTIPLE_OUTPUT
OUTPUT_AND_EXIT_POINT
@@ -171,7 +170,6 @@ class AnalysisResult (
NO_EXPRESSION -> "cannot.refactor.no.expresson"
NO_CONTAINER -> "cannot.refactor.no.container"
SUPER_CALL -> "cannot.extract.super.call"
NON_LOCAL_DECLARATION -> "cannot.extract.non.local.declaration.ref"
DENOTABLE_TYPES -> "parameter.types.are.not.denotable"
MULTIPLE_OUTPUT -> "selected.code.fragment.has.multiple.output.values"
OUTPUT_AND_EXIT_POINT -> "selected.code.fragment.has.output.values.and.exit.points"
@@ -346,9 +346,7 @@ private fun ExtractionData.inferParametersInfo(
if (hasClassObjectReceiver) thisDescriptor!!.getContainingDeclaration() as? ClassDescriptor else null
if (classObjectClassDescriptor != null) {
if (!classObjectClassDescriptor.canBeReferencedViaImport()) {
return ErrorMessage.NON_LOCAL_DECLARATION
}
assert (classObjectClassDescriptor.canBeReferencedViaImport(), "Class object should be allowed only for importable classes: className = ${classObjectClassDescriptor.getName().asString()}")
replacementMap[refInfo.offsetInBody] = FqNameReplacement(DescriptorUtils.getFqNameSafe(originalDescriptor))
}