sclass ConvertLASToJava { replace Tk with GazelleV_LeftArrowScript. delegate Evaluable to Tk. O get(LASClassDef.FieldDef field) { ret field.type() + " " + field.name() + ";"; } O get(Tk.FunctionDef f) { ret "O " + f.name + "(" + joinWithComma(map(f.args, arg -> "O " + arg)) + ") {\n" + indentx(strOrNull(get(f.body))); } O get(Evaluable o) { if (o == null) null; // These are the properly implemented cases if (o cast Tk.GetVar) ret o.var; if (o cast Tk.Script) ret lines(map get(o.steps)); if (o cast Tk.ClassDef) { LASClassDef c = o.lasClass.classDef; ret "class " + c.userGivenName + " " + curly("\n" + indentx( joinNemptiesWithEmptyLines( lines_rtrim(map get(c.fields)), lines_rtrim(map get(c.methods))) )) + "\n}"; } warn("Can't convert to Java: " + className(o)); // Retain original script text as a default if (o cast Tk.Base) { var src = o.tokenRangeWithSrc(); if (src != null) ret src.text(); } // If that fails (it shouldn't), just return the toString warn("No source reference in script object: " + className(o)); ret str(o); } }