internal override void GenStatementCode(CompileContext compileContext, bool bGenDebug) { Label lblTop = compileContext.gen.DefineLabel(); base.continuedest = compileContext.gen.DefineLabel(); Label lblBody = compileContext.gen.DefineLabel(); StatementNode A = (((CommonTree)base.Children[0]).ChildCount != 0) ? ((StatementNode)((CommonTree)base.Children[0]).Children[0]) : null; if (A != null) { foreach (baseNode n in A.EnumerateAll()) { if (n is InNode) { throw new JSRuntimeException("SyntaxError", "Invalid for/in"); } } } ExpressionNode B = (((CommonTree)base.Children[1]).ChildCount != 0) ? ((ExpressionNode)((CommonTree)base.Children[1]).Children[0]) : null; StatementNode C = (((CommonTree)base.Children[2]).ChildCount != 0) ? ((StatementNode)((CommonTree)base.Children[2]).Children[0]) : null; StatementNode D = (StatementNode)((CommonTree)base.Children[3]); bool _track = compileContext.TrackImplicitReturnValue; if (A != null) { compileContext.TrackImplicitReturnValue = false; A.GenCode(compileContext); compileContext.TrackImplicitReturnValue = _track; } compileContext.gen.MarkLabel(lblTop); if (B != null) { B.GenLazyEval(compileContext, lblBody, base.breakdest); } compileContext.gen.MarkLabel(lblBody); D.GenCode(compileContext); compileContext.gen.MarkLabel(base.continuedest); if (C != null) { compileContext.TrackImplicitReturnValue = false; C.GenCode(compileContext); compileContext.TrackImplicitReturnValue = _track; } compileContext.gen.Emit(OpCodes.Br, lblTop); }
protected void GenerateFunctionBody(StatementNode r, ILGenerator gen) { LocalFunctionData oldData = this.fncData; try { this.fncData = new LocalFunctionData(gen, gen.DefineLabel(), gen.DeclareLocal(typeof(JSValue))); r.GenCode(this); gen.EmitCallV(mi_JSUndefined_Instance); gen.Emit(OpCodes.Stloc, this.fncData.return_local); gen.MarkLabel(this.fncData.return_label); gen.Emit(OpCodes.Ldloc, this.fncData.return_local); gen.Emit(OpCodes.Ret); } finally { this.fncData = oldData; } }
private void GenerateCode(StatementNode r) { r.GenCode(this); }