public VMException(FunctionDefn defn, string filename, Statement st, Exception inner)
     : base("", inner)
 {
     this.defn = defn;
     this.st = st;
     this.filename = filename;
 }
 public bool ImplementsMethod(FunctionDefn f)
 {
     List<FunctionDefn> matches = new List<FunctionDefn>(GetMethods(f.name));
     foreach (FunctionDefn fd in matches)
         if (fd.Matches(f))
             return true;
     return false;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="f"></param>
 /// <param name="self"></param>
 public Frame(FunctionDefn f, ClassInstance self, ModuleInstance mi)
 {
     this.function = f;
     this.self = self;
     moduleInstance = mi;
     if (self != null)
         moduleDef = self.Type.GetModule();
     AddScope(new Scope());
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new frame, and returns a frame manager, which will release the frame
 /// on Dispose.
 /// </summary>
 /// <param name="fun"></param>
 /// <param name="classInstance"></param>
 /// <returns></returns>
 public DisposableFrame CreateFrame(FunctionDefn fun, ClassInstance classInstance, ModuleInstance mi)
 {
     return new DisposableFrame(this, fun, classInstance, mi);
 }
Beispiel #5
0
 public DisposableFrame(VM vm, FunctionDefn def, ClassInstance ci, ModuleInstance mi)
 {
     this.vm = vm;
     vm.PushNewFrame(def, ci, mi);
 }
Beispiel #6
0
 /// <summary>
 /// Called when a new function execution starts.
 /// </summary>
 /// <param name="f"></param>
 /// <param name="self"></param>
 public void PushNewFrame(FunctionDefn f, ClassInstance self, ModuleInstance mi)
 {
     frames.Add(new Frame(f, self, mi));
 }
 public void AddMethod(FunctionDefn x)
 {
     methods.Add(x);
 }
 public FunctionValue(HeronValue self, FunctionDefn f)
 {
     this.self = self;
     fun = f;
 }