public int TailCall(int argumentCount, LabelOperand label, List <ImmediateOperand> unpackIndices) { Emit(new Instruction( InstructionType.TailCall, new ImmediateOperand(argumentCount), label, new ImmediateOperand(unpackIndices.Count), new ListOperand <ImmediateOperand>(unpackIndices))); return(-argumentCount); }
public FunctionContext(ExpressionCompiler compiler, int frameIndex, Scope prevScope, string parentName, string name) { _instructions = new List <Instruction>(); _loopLabels = new IndexedStack <Tuple <LabelOperand, LabelOperand> >(); Compiler = compiler; FrameIndex = frameIndex; Scope = new Scope(frameIndex, prevScope); ParentName = parentName; Name = name; FullName = string.Format("{0}{1}{2}", parentName, string.IsNullOrEmpty(parentName) ? "" : ".", Name ?? ""); AssignedName = name != null?prevScope.Get(name) : null; Label = Compiler.MakeLabel("function"); IdentifierCount = 0; }
public int Bind(LabelOperand label) { Emit(new Instruction(InstructionType.Label, label)); return(0); }
public int JumpFalsePeek(LabelOperand label) { Emit(new Instruction(InstructionType.JmpFalseP, label)); return(0); }
public int JumpFalse(LabelOperand label) { Emit(new Instruction(InstructionType.JmpFalse, label)); return(-1); }
public int TailCall(int argumentCount, LabelOperand label) { Emit(new Instruction(InstructionType.TailCall, new ImmediateOperand(argumentCount), label)); return(-argumentCount); }
public int Closure(LabelOperand label) { Emit(new Instruction(InstructionType.Closure, label)); return(1); }
public virtual void PushLoop(LabelOperand continueTarget, LabelOperand breakTarget) { _loopLabels.Push(Tuple.Create(continueTarget, breakTarget)); }