Пример #1
0
        private void LoadFileContext(SymbolTable table, ModuleBuilder moduleBuilder, out MethodInfo entryPoint, out ConstructorInfo entryConstructor)
        {
            entryPoint       = null;
            entryConstructor = null;
            //Load classes
            foreach (var child in program.Children)
            {
                if (child is ClassHeaderContext header)
                {
                    var eval = new ClassEvaluator(this, header);
                    eval.LoadClass(table.Children[header.Name], moduleBuilder);

                    classes.Add(header.Name, eval);
                }
            }

            //Load classes
            foreach (var child in classes)
            {
                child.Value.LoadClassMembers(table.Children[child.Key].Children["classMembers"]);
                if (child.Value.EntryPoint != null)
                {
                    entryPoint       = child.Value.EntryPoint;
                    entryConstructor = child.Value.Constructor.ConstructorBuilder;
                }
            }

            //Create method bodies and construct final Types
            foreach (var child in classes)
            {
                child.Value.CreateClass(table.Children[child.Key].Children["classMembers"]);
            }
        }
Пример #2
0
        public MethodEvaluatorBase(FunctionHeaderContext header, ClassEvaluator parent)
        {
            Header      = header;
            this.parent = parent;

            paramVariables.Add("this");
            paramVariables.AddRange(header.ParamNames);
        }
Пример #3
0
 public MethodEvaluator(MethodBuilder methodBuilder, FunctionHeaderContext header, ClassEvaluator parent) : base(header, parent)
 {
     MethodBuilder = methodBuilder;
 }
Пример #4
0
        internal static ConstructorEvaluator GenerateConstructor(ConstructorBuilder constructorBuilder, ClassEvaluator parent, string name)
        {
            var header = new FunctionHeaderContext(AccessModifiers.Public);

            header.Children.AddLast(new IdentifierContext()
            {
                Identifier = name
            });
            return(new ConstructorEvaluator(constructorBuilder, header, parent));
        }
Пример #5
0
 public ConstructorEvaluator(ConstructorBuilder constructorBuilder, FunctionHeaderContext header, ClassEvaluator parent) : base(header, parent)
 {
     ConstructorBuilder = constructorBuilder;
 }