implement set, the, string interpolation in kissinterp2
Some checks failed
CI / test (push) Failing after 52s
CI / test-core (14, ubuntu-latest, 3.x, cpp) (push) Failing after 2m5s
CI / test-core (14, ubuntu-latest, 3.x, py) (push) Failing after 2m50s
CI / test-core (14, ubuntu-latest, 3.x, nodejs) (push) Failing after 3m53s
CI / test-core (14, ubuntu-latest, 3.x, js) (push) Failing after 2m51s
CI / test-core (14, ubuntu-latest, 3.x, interp) (push) Failing after 2m20s

This commit is contained in:
2025-11-11 19:33:08 -06:00
parent 4f2bdf0f7f
commit 8c8c03a7ad

View File

@@ -15,7 +15,13 @@
(prop &mut :Map<String,ReaderExpDef> identAliases (new Map))
(prop &mut :Map<String,ReaderExpDef> callAliases (new Map))
(prop :Map<String,Dynamic> globals [=>"false" false =>"true" true =>"null" null])
(prop :Map<String,Dynamic> globals [
=>"false" false
=>"true" true
=>"null" null
=>"Std" Std
=>"the" ->[_ v] v
])
(prop &mut :kiss.List<Map<String,Dynamic>> localScopes [])
(prop :Map<String,(Array<ReaderExp>,Dynamic->Void)->Void> specialForms)
@@ -145,6 +151,26 @@
func (makeFunction argExps bodyExps)]
(dictSet globals name func)
(cc func))
=>"set"
->[args cc]
(evalCC (second args)
->v
(case .def (transformToFieldExp (first args))
((Symbol varName)
(doFor scope (reverse localScopes)
(when (scope.exists varName)
(dictSet scope varName v)
(cc v)
(return)))
(when (globals.exists varName)
(dictSet globals varName v)))
((FieldExp field objExp _)
(evalCC objExp ->obj {
(Reflect.setProperty obj field v)
(cc v)
}))
(never otherwise)))
])
(method :ReaderExp read [:Dynamic input]