mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-04 14:51:26 -04:00
fix: remove empty body error -> fall back to silence
This commit is contained in:
@@ -257,14 +257,7 @@ export function transpiler(input, options = {}) {
|
||||
body.push(silenceExpression);
|
||||
} else if (!body?.[body.length - 1]?.expression) {
|
||||
// Last statement is not an expression (e.g., VariableDeclaration, FunctionDeclaration)
|
||||
if (blockBased) {
|
||||
// For block-based eval, add silence as the return value when block ends with declaration
|
||||
body.push(silenceExpression);
|
||||
} else {
|
||||
if (!prebake) {
|
||||
throw new Error('unexpected ast format without body expression');
|
||||
}
|
||||
}
|
||||
body.push(silenceExpression);
|
||||
}
|
||||
|
||||
// For block-based eval, add scope assignments before the return statement
|
||||
|
||||
Reference in New Issue
Block a user