K2 Scripting: wrap script statements into blocks

(reuse anonymous initializers as block wrappers) so the top-level script
elements are all declarations now. Rename the property accordingly (
together with the previous commit).
It makes script more similar to the class and thus simplify e.g.
control flow analysis and resolve code.
This commit is contained in:
Ilya Chernikov
2023-11-22 16:40:51 +01:00
committed by Space Team
parent c9aee5bf09
commit eeb723eb01
20 changed files with 224 additions and 156 deletions
@@ -494,10 +494,10 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
script.configure {
+name
+FieldList("declarations", statement, withReplace = true, useMutableOrEmpty = true).withTransform()
+declarations.withTransform().withReplace()
+symbol("FirScriptSymbol")
+fieldList("parameters", variable, withReplace = false)
+fieldList(contextReceiver, useMutableOrEmpty = true)
+fieldList("parameters", property).withTransform()
+fieldList(contextReceiver, useMutableOrEmpty = true).withTransform()
+field("resultPropertyName", nameType, nullable = true)
}