Exemplo n.º 1
0
        public FileGen(string fileName)
        {
            _fileName = fileName;
            _sb       = new StringBuilderWithIdent();

            _sb.AppendLineA(Constants.Imports);
        }
Exemplo n.º 2
0
        private string GetFieldsListInit()
        {
            StringBuilderWithIdent sb = new StringBuilderWithIdent {
                Ident = 1
            };

            foreach (var field in _fieldsInit)
            {
                sb.AppendLineA($"public dynamic {field.Key} = {field.Value};");
            }

            return(sb.ToString());
        }
Exemplo n.º 3
0
        public TypeGen(StringBuilderWithIdent sb)
        {
            _sb = sb;
            _sb.AppendLineA($"public class {Constants.ClassName} : LuaObject");
            _sb.AppendLineA("{");
            _sb.Ident++;
            _sb.AppendLineNoIdentA(Constants.Fields);
            _sb.AppendLineNoIdentA(Constants.FieldsInit);
            _sb.AppendLineNoIdentA(Constants.ImplicitCtor);

            _fields     = new HashSet <string>();
            _fieldsInit = new Dictionary <string, Operand>();
        }
Exemplo n.º 4
0
        private string GetDependencyInit()
        {
            var sb = new StringBuilderWithIdent()
            {
                Ident = 2
            };

            foreach (var dependencyInitializer in Env.Instance.GetDependencyInitializers())
            {
                sb.AppendLineA($"this.{dependencyInitializer.Key} = new {dependencyInitializer.Value}();");
            }

            return(sb.ToString());
        }
Exemplo n.º 5
0
 public CodeGen(StringBuilderWithIdent sb)
 {
     _sb         = sb;
     _startIdent = sb.Ident;
 }