예제 #1
0
 private void CompileClassMethod(IBehavior cls, string text, Machine machine)
 {
     Parser parser = new Parser(text);
     cls.DefineClassMethod(parser.CompileClassMethod(cls));
 }
예제 #2
0
        private void DeserializeMethods(IBehavior behavior)
        {
            int nmethods = (int)this.Deserialize();

            for (int k = 0; k < nmethods; k++)
            {
                string mthname = (string)this.Deserialize();
                string mthsource = (string)this.Deserialize();
                var method = this.compiler.CompileInstanceMethod(mthsource, behavior);
                behavior.DefineInstanceMethod(method);
            }

            int nclassmethods = (int)this.Deserialize();

            for (int k = 0; k < nclassmethods; k++)
            {
                string mthname = (string)this.Deserialize();
                string mthsource = (string)this.Deserialize();
                var method = this.compiler.CompileClassMethod(mthsource, behavior);
                behavior.DefineClassMethod(method);
            }
        }