public void GeneratePushArguments(ScriptCompiler.Context context) { foreach (Expression item in Arguments) { context.Generate(item); } }
protected override void GenerateBlockBefore(ScriptCompiler.Context context) { if (Condition == null) { throw new InvalidOperationException("Condition"); } }
protected override void GenerateBlockEnd(ScriptCompiler.Context context) { if (Else != null) { context.Jump(EndLabel); context.InidicateLabel(ElseLabel); context.Generate(Else); } }
protected override void GenerateBlockBegin(ScriptCompiler.Context context) { if (Else != null) { context.IfFalseThenJump(Condition, ElseLabel); } else { context.IfFalseThenJump(Condition, EndLabel); } }
private Iteration FindIterationBlock(ScriptCompiler.Context context) { for (int i = context.CurrentBlocks.Count - 1; i >= 0; i--) { if (context.CurrentBlocks[i] is Iteration) { return((Iteration)context.CurrentBlocks[i]); } } return(null); }
public override void Generate(ScriptCompiler.Context context) { Iteration iterationBlock = FindIterationBlock(context); if (iterationBlock != null) { context.Jump(iterationBlock.LoopLabel); } else { throw new InvalidOperationException("continue must be in iteration block"); } }
public override void Generate(ScriptCompiler.Context context) { if (Variable == null) { throw new InvalidOperationException(); } if (Value == null) { throw new InvalidOperationException(); } context.Assign(Variable.Name, Value); }
protected void Generate(ScriptCompiler.Context context, ScriptInstruction instruction) { if (LeftOperand == null) { throw new InvalidOperationException("LeftOperand"); } if (RightOperand == null) { throw new InvalidOperationException("RightOperand"); } context.BinaryOperator(instruction, LeftOperand, RightOperand); }
public sealed override void Generate(ScriptCompiler.Context context) { GenerateBlockBefore(context); context.InidicateLabel(BeginLabel); GenerateBlockBegin(context); foreach (Statement item in statements) { context.Generate(item); } GenerateBlockEnd(context); context.InidicateLabel(EndLabel); GenerateBlockAfter(context); }
public override void Generate(ScriptCompiler.Context context) { context.CallScriptFunction(Name, Arguments); }
public override void Generate(ScriptCompiler.Context context) { context.Jump(context.CurrentBlock.EndLabel); }
public override void Generate(ScriptCompiler.Context context) { Generate(context, ScriptInstruction.AddInt); }
public override void Generate(ScriptCompiler.Context context) { switch (Type.GetTypeCode(Value.GetType())) { case TypeCode.Empty: throw new NotSupportedException(); case TypeCode.Object: Type type = Value.GetType(); if (type == typeof(Color)) { context.Push((Color)Value); } else if (type == typeof(Vector2)) { context.Push((Vector2)Value); } else if (type == typeof(Vector3)) { context.Push((Vector3)Value); } else if (type == typeof(Vector4)) { context.Push((Vector4)Value); } else { throw new InvalidOperationException(); } break; case TypeCode.DBNull: throw new NotSupportedException(); case TypeCode.Boolean: context.Push((bool)Value); break; case TypeCode.Char: case TypeCode.SByte: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.UInt16: case TypeCode.Int32: context.Push(Convert.ToInt32(Value)); break; case TypeCode.UInt32: context.Push(Convert.ToUInt32(Value)); break; case TypeCode.Int64: case TypeCode.UInt64: context.Push(Convert.ToInt64(Value)); break; case TypeCode.Single: case TypeCode.Double: context.Push(Convert.ToSingle(Value)); break; case TypeCode.Decimal: throw new InvalidOperationException(); case TypeCode.DateTime: throw new InvalidOperationException(); case TypeCode.String: context.Push((string)Value); break; } }
protected virtual void GenerateBlockAfter(ScriptCompiler.Context context) { }
public override void Generate(ScriptCompiler.Context context) { Generate(context, ScriptInstruction.TestEqualityInt); }
public virtual ScriptObjectType GuessResultType(ScriptCompiler.Context context) { return(ScriptObjectType.Void); }
public override void Generate(ScriptCompiler.Context context) { context.Return(Value); }
public override void Generate(ScriptCompiler.Context context) { // ... 아무 명령도 생성하지 않습니다 ... }
public override void Generate(ScriptCompiler.Context context) { throw new InvalidOperationException("must call WriteLabel or WriteAddress"); }
public override void Generate(ScriptCompiler.Context context) { // ... Compiler에서 구분용으로 쓰는 식별자이기 때문에 아무 명령도 생성하지 않습니다 ... }
protected virtual void GenerateBlockBefore(ScriptCompiler.Context context) { }
protected override void GenerateBlockBegin(ScriptCompiler.Context context) { context.Function(ComputeRequiredStackSize(true)); }
protected override void GenerateBlockEnd(ScriptCompiler.Context context) { context.Jump(LoopLabel); }
public override void Generate(ScriptCompiler.Context context) { context.PushVariable(Name); }
public abstract void Generate(ScriptCompiler.Context context);
protected override void GenerateBlockBegin(ScriptCompiler.Context context) { context.InidicateLabel(LoopLabel); context.IfFalseThenJump(Condition, EndLabel); }