refactor: move module load failure handling from Wren to C with error string return
The loadModule_ primitive now returns NULL for already-loaded modules and an error string for missing modules, shifting the error handling from Wren's Fiber.abort to C's native string return. The Wren import_ method simplifies to only call the result when non-null, removing the false/true branching logic.
This commit is contained in:
+1
-5
@@ -61,11 +61,7 @@ class Sequence {
|
||||
class String is Sequence {
|
||||
import_(variable) {
|
||||
var result = loadModule_
|
||||
if (result == false) {
|
||||
Fiber.abort("Could not find module '" + this + "'.")
|
||||
} else if (result != true) {
|
||||
result.call
|
||||
}
|
||||
if (result != null) result.call
|
||||
|
||||
return lookUpVariable_(variable)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user