diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/JetControlFlowInstructionsGenerator.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/JetControlFlowInstructionsGenerator.java index 377e847396d..9b3862d040c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/JetControlFlowInstructionsGenerator.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/JetControlFlowInstructionsGenerator.java @@ -106,7 +106,7 @@ public class JetControlFlowInstructionsGenerator extends JetControlFlowBuilderAd private final PseudoValueFactory valueFactory = new PseudoValueFactoryImpl() { @NotNull @Override - public PseudoValue newValue(@Nullable JetElement element, @NotNull Instruction instruction) { + public PseudoValue newValue(@Nullable JetElement element, @NotNull InstructionWithValue instruction) { PseudoValue value = super.newValue(element, instruction); if (element != null) { bindValue(value, element); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValue.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValue.kt index 83bfa53d6c8..95a4e2976c7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValue.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValue.kt @@ -17,14 +17,14 @@ package org.jetbrains.jet.lang.cfg.pseudocode import org.jetbrains.jet.lang.psi.JetElement -import org.jetbrains.jet.lang.cfg.pseudocode.instructions.Instruction +import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.InstructionWithValue public trait PseudoValue { public val debugName: String public val element: JetElement? - public val createdAt: Instruction + public val createdAt: InstructionWithValue } public trait PseudoValueFactory { - public fun newValue(element: JetElement?, instruction: Instruction): PseudoValue + public fun newValue(element: JetElement?, instruction: InstructionWithValue): PseudoValue } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValueImpl.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValueImpl.kt index c902c58456d..c5ce4ee1354 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValueImpl.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudoValueImpl.kt @@ -17,12 +17,12 @@ package org.jetbrains.jet.lang.cfg.pseudocode import org.jetbrains.jet.lang.psi.JetElement -import org.jetbrains.jet.lang.cfg.pseudocode.instructions.Instruction +import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.InstructionWithValue class PseudoValueImpl( public override val debugName: String, public override val element: JetElement?, - public override val createdAt: Instruction + public override val createdAt: InstructionWithValue ) : PseudoValue { override fun toString(): String = debugName } @@ -30,7 +30,7 @@ class PseudoValueImpl( open class PseudoValueFactoryImpl: PseudoValueFactory { private var lastIndex: Int = 0 - override fun newValue(element: JetElement?, instruction: Instruction): PseudoValue { + override fun newValue(element: JetElement?, instruction: InstructionWithValue): PseudoValue { return PseudoValueImpl("", element, instruction) } } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/Instruction.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/Instruction.kt index e1b0a13c7da..17fbcaaeffe 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/Instruction.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/Instruction.kt @@ -29,7 +29,6 @@ public trait Instruction { public val lexicalScope: LexicalScope public val inputValues: List - public val outputValue: pseudocode.PseudoValue? public fun getCopies(): Collection diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/InstructionImpl.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/InstructionImpl.kt index 05a1fd2f873..bb367a57f1b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/InstructionImpl.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/InstructionImpl.kt @@ -69,7 +69,6 @@ public abstract class InstructionImpl(public override val lexicalScope: LexicalS override val previousInstructions: MutableCollection = LinkedHashSet() override val inputValues: List = Collections.emptyList() - override val outputValue: PseudoValue? = null override fun getCopies(): Collection { return original?.let { original -> diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/InstructionWithValue.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/InstructionWithValue.kt new file mode 100644 index 00000000000..eb7f7e640f2 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/InstructionWithValue.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2014 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. + */ + +package org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval + +import org.jetbrains.jet.lang.cfg.pseudocode.instructions.JetElementInstruction +import org.jetbrains.jet.lang.cfg.pseudocode.PseudoValue + +public trait InstructionWithValue : JetElementInstruction { + public val outputValue: PseudoValue? +} \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/ReadValueInstruction.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/ReadValueInstruction.kt index 03aad9b692b..b1de88899a3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/ReadValueInstruction.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/ReadValueInstruction.kt @@ -20,7 +20,6 @@ import org.jetbrains.jet.lang.psi.JetElement import org.jetbrains.jet.lang.cfg.pseudocode.PseudoValueFactory import org.jetbrains.jet.lang.cfg.pseudocode.PseudoValue import org.jetbrains.jet.lang.cfg.pseudocode.instructions.LexicalScope -import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.InstructionWithReceiver import org.jetbrains.jet.lang.cfg.pseudocode.instructions.InstructionVisitor import org.jetbrains.jet.lang.cfg.pseudocode.instructions.InstructionVisitorWithResult import org.jetbrains.jet.lang.cfg.pseudocode.instructions.InstructionImpl @@ -30,7 +29,7 @@ public class ReadValueInstruction private ( lexicalScope: LexicalScope, receiverValue: PseudoValue?, private var _outputValue: PseudoValue? -) : InstructionWithReceiver(element, lexicalScope, receiverValue) { +) : InstructionWithReceiver(element, lexicalScope, receiverValue), InstructionWithValue { private fun newResultValue(factory: PseudoValueFactory) { _outputValue = factory.newValue(element, this) } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/WriteValueInstruction.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/WriteValueInstruction.kt index c8e7e266db9..0e7a40bfe7d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/WriteValueInstruction.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/WriteValueInstruction.kt @@ -21,7 +21,6 @@ import org.jetbrains.jet.lang.psi.JetNamedDeclaration import java.util.Collections import org.jetbrains.jet.lang.cfg.pseudocode.PseudoValue import org.jetbrains.jet.lang.cfg.pseudocode.instructions.LexicalScope -import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.InstructionWithReceiver import org.jetbrains.jet.lang.cfg.pseudocode.instructions.InstructionVisitor import java.util.Arrays import org.jetbrains.jet.lang.cfg.pseudocode.instructions.InstructionVisitorWithResult diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt index cb82b3942c2..ae7634e4c29 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt @@ -29,7 +29,7 @@ public abstract class OperationInstruction protected( element: JetElement, lexicalScope: LexicalScope, public override val inputValues: List -) : InstructionWithNext(element, lexicalScope) { +) : InstructionWithNext(element, lexicalScope), InstructionWithValue { protected var resultValue: PseudoValue? = null override val outputValue: PseudoValue?