Skip to content

Commit

Permalink
Interpreter: Add more detail for unsupported expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
mattco98 committed Oct 5, 2022
1 parent 312a3ed commit ec8b5f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/main/kotlin/org/serenityos/jakt/comptime/Interpreter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class Interpreter(element: JaktPsiElement) {
return when (element) {
/*** EXPRESSIONS ***/

is JaktMatchExpression -> TODO()
is JaktTryExpression -> TODO()
is JaktLambdaExpression -> TODO()
is JaktMatchExpression -> TODO("comptime match expressions")
is JaktTryExpression -> TODO("comptime try expressions")
is JaktLambdaExpression -> TODO("comptime lambdas")
is JaktAssignmentBinaryExpression -> {
val binaryOp = when {
element.plusEquals != null -> BinaryOperator.Add
Expand Down Expand Up @@ -145,8 +145,8 @@ class Interpreter(element: JaktPsiElement) {

ExecutionResult.Normal(VoidValue)
}
is JaktThisExpression -> TODO()
is JaktFieldAccessExpression -> TODO()
is JaktThisExpression -> TODO("comptime this expressions")
is JaktFieldAccessExpression -> TODO("comptime field access")
is JaktRangeExpression -> {
val (startExpr, endExpr) = when {
element.expressionList.size == 2 -> element.expressionList[0] to element.expressionList[1]
Expand Down Expand Up @@ -229,9 +229,9 @@ class Interpreter(element: JaktPsiElement) {
else -> BinaryOperator.Modulo
},
)
is JaktCastExpression -> TODO()
is JaktIsExpression -> TODO()
is JaktUnaryExpression -> TODO()
is JaktCastExpression -> TODO("comptime casts")
is JaktIsExpression -> TODO("comptime is expressions")
is JaktUnaryExpression -> TODO("comptime unary expressions")
is JaktBooleanLiteral -> ExecutionResult.Normal(BoolValue(element.trueKeyword != null))
is JaktNumericLiteral -> {
element.binaryLiteral?.let {
Expand Down Expand Up @@ -424,9 +424,9 @@ class Interpreter(element: JaktPsiElement) {

ExecutionResult.Normal(VoidValue)
}
is JaktWhileStatement -> TODO()
is JaktLoopStatement -> TODO()
is JaktForStatement -> TODO()
is JaktWhileStatement -> TODO("comptime while statements")
is JaktLoopStatement -> TODO("comptime loop statements")
is JaktForStatement -> TODO("comptime for statements")
is JaktVariableDeclarationStatement -> {
if (element.parenOpen != null) {
error(
Expand All @@ -440,7 +440,7 @@ class Interpreter(element: JaktPsiElement) {

ExecutionResult.Normal(VoidValue)
}
is JaktGuardStatement -> TODO()
is JaktGuardStatement -> TODO("comptime guard statements")
is JaktYieldStatement -> ExecutionResult.Yield(evaluateNonYield(element.expression) { return it })
is JaktBreakStatement -> ExecutionResult.Break
is JaktContinueStatement -> ExecutionResult.Continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class ShowComptimeValueAction : AnAction() {

private val AnActionEvent.element: PsiElement?
get() {
// TODO: CommonDataKeys.PSI_ELEMENT?
val file = dataContext.getData(CommonDataKeys.PSI_FILE) ?: return null
val editor = dataContext.getData(CommonDataKeys.EDITOR) ?: return null
return file.findElementAt(editor.caretModel.offset)
Expand Down

0 comments on commit ec8b5f9

Please # to comment.