convert CallFrameBase, CallFrame to kotlin

This commit is contained in:
Vladimir Krivosheev
2015-11-24 09:47:20 +01:00
parent 4fc8198924
commit f641cf2296
2 changed files with 32 additions and 82 deletions
@@ -1,46 +1,37 @@
package org.jetbrains.debugger;
package org.jetbrains.debugger
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.concurrency.Promise;
import org.jetbrains.concurrency.Promise
import java.util.List;
public interface CallFrame {
interface CallFrame {
/**
* @return the scopes known in this frame
*/
@NotNull
List<Scope> getVariableScopes();
val variableScopes: List<Scope>
boolean hasOnlyGlobalScope();
val hasOnlyGlobalScope: Boolean
/**
* @return the receiver variable known in this frame ("this" variable)
*
* Computed variable must be null if no receiver variable, call {@link com.intellij.openapi.util.AsyncResult#setDone(Object null)}
* receiver variable known in this frame ("this" variable)
* Computed variable must be null if no receiver variable
*/
@NotNull
Promise<Variable> getReceiverVariable();
val receiverVariable: Promise<Variable?>
int getLine();
val line: Int
int getColumn();
val column: Int
/**
* @return the name of the current function of this frame
*/
@Nullable
String getFunctionName();
val functionName: String?
/**
* @return context for evaluating expressions in scope of this frame
*/
@NotNull
EvaluateContext getEvaluateContext();
val evaluateContext: EvaluateContext
/**
@see com.intellij.xdebugger.frame.XStackFrame#getEqualityObject()
* @see com.intellij.xdebugger.frame.XStackFrame.getEqualityObject
*/
Object getEqualityObject();
val equalityObject: Any
}
@@ -1,65 +1,24 @@
package org.jetbrains.debugger;
package org.jetbrains.debugger
import com.intellij.openapi.util.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.intellij.openapi.util.NotNullLazyValue
import java.util.List;
const val RECEIVER_NAME = "this"
public abstract class CallFrameBase implements CallFrame {
public static final String RECEIVER_NAME = "this";
@Deprecated("")
/**
* Use kotlin - base class is not required in this case (no boilerplate code)
*/
/**
* You must initialize [.scopes] or override [.getVariableScopes]
*/
abstract class CallFrameBase(override val functionName: String?, override val line: Int, override val column: Int, override val evaluateContext: EvaluateContext) : CallFrame {
protected var scopes: NotNullLazyValue<List<Scope>>? = null
private final String functionName;
private final int line;
private final int column;
override var hasOnlyGlobalScope: Boolean = false
protected set(value: Boolean) {
field = value
}
protected NotNullLazyValue<List<Scope>> scopes;
protected EvaluateContext evaluateContext;
protected boolean hasOnlyGlobalScope;
/**
* You must initialize {@link #scopes} or override {@link #getVariableScopes()}
*/
protected CallFrameBase(@Nullable String functionName, int line, int column, @Nullable("init in your constructor") EvaluateContext evaluateContext) {
this.functionName = functionName;
this.line = line;
this.column = column;
this.evaluateContext = evaluateContext;
}
@Override
public final boolean hasOnlyGlobalScope() {
return hasOnlyGlobalScope;
}
@NotNull
@Override
public List<Scope> getVariableScopes() {
return scopes.getValue();
}
@Nullable
@Override
public String getFunctionName() {
return functionName;
}
@Override
public int getLine() {
return line;
}
@Override
public int getColumn() {
return column;
}
@NotNull
@Override
public final EvaluateContext getEvaluateContext() {
return evaluateContext;
}
override val variableScopes: List<Scope>
get() = scopes!!.value
}