public void VisitClass(ClassDef c) { if (VisitDecorators(c)) { return; } var baseClasses = c.args.Select(a => GenerateBaseClassName(a.defval !)).ToList(); var comments = ConvertFirstStringToComments(c.body.stmts); var gensym = new SymbolGenerator(); var stmtXlt = new StatementTranslator(c, types, gen, gensym, new HashSet <string>()); stmtXlt.properties = FindProperties(c.body.stmts); var csClass = gen.Class( c.name.Name, baseClasses, () => GenerateFields(c), () => c.body.Accept(stmtXlt)); csClass.Comments.AddRange(comments); if (customAttrs != null) { csClass.CustomAttributes.AddRange(customAttrs); customAttrs = null; } }
public ExpTranslator(TypeReferenceTranslator types, CodeGenerator gen, SymbolGenerator gensym) { this.types = types; this.m = gen; this.gensym = gensym; this.intrinsic = new IntrinsicTranslator(this); }
public StatementTranslator(TypeReferenceTranslator types, CodeGenerator gen, SymbolGenerator gensym, HashSet <string> globals) { this.types = types; this.gen = gen; this.gensym = gensym; this.xlat = new ExpTranslator(types, gen, gensym); this.properties = new Dictionary <Statement, PropertyDefinition>(); this.globals = globals; }
public MethodGenerator( FunctionDef f, string fnName, List <Parameter> args, bool isStatic, bool isAsync, TypeReferenceTranslator types, CodeGenerator gen) { this.f = f; this.fnName = fnName; this.args = args; this.isStatic = isStatic; this.isAsync = isAsync; this.gen = gen; this.gensym = new SymbolGenerator(); this.types = new TypeReferenceTranslator(new Dictionary <Node, DataType>()); this.xlat = new ExpTranslator(this.types, gen, gensym); this.globals = new HashSet <string>(); this.stmtXlat = new StatementTranslator(types, gen, gensym, globals); }
public MethodGenerator( ClassDef?classDef, FunctionDef f, string?fnName, List <Parameter> args, bool isStatic, bool isAsync, TypeReferenceTranslator types, CodeGenerator gen) { this.classDef = classDef; this.f = f; this.fnName = fnName; this.args = args; this.isStatic = isStatic; this.isAsync = isAsync; this.gen = gen; this.gensym = new SymbolGenerator(); this.types = types; this.xlat = new ExpTranslator(classDef, this.types, gen, gensym); this.globals = new HashSet <string>(); this.stmtXlat = new StatementTranslator(classDef, types, gen, gensym, globals); }