refs #22 try without catch but finally

This commit is contained in:
sergeych committed 2025-06-13 01:44:13 +04:00
1 parent 0981d8370e
commit 88974e0f2d
3 files changed
+20 -3

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
group = "net.sergeych"
version = "0.5.1-SNAPSHOT"
version = "0.5.2-SNAPSHOT"
buildscript {
repositories {
@@ -790,8 +790,6 @@ class Compiler(
t = cc.next()
}
}
if( catches.isEmpty() )
throw ScriptError(cc.currentPos(), "try block must have at least one catch clause")
val finallyClause = if( t.value == "finally" ) {
parseBlock(cc)
} else {
@@ -799,6 +797,9 @@ class Compiler(
null
}
if( catches.isEmpty() && finallyClause == null )
throw ScriptError(cc.currentPos(), "try block must have either catch or finally clause or both")
return statement {
var result: Obj = ObjVoid
try {