protected override void Jump(GotoStatement node, bool isContinue) { var labelInfo = _labelInfos.GetLabelInfo(node.Target); string error = null; if (labelInfo == null) { if (node.Target == null) if (isContinue) error = "SyntaxError: Illegal continue statement"; else error = "SyntaxError: Illegal break statement"; else error = string.Format("SyntaxError: Undefined label '{0}'", node.Target); } else if (isContinue && !labelInfo.HasContinueTarget) error = string.Format("SyntaxError: Undefined label '{0}'", node.Target); if (error != null) { var tmpException = new ThrowStatement(new StringLiteral(error)); VisitNode(tmpException); //We call visit here to have the proper override of it get called. //TODO: var ErrorCall = new InternalCall(CodeGen.Types.Operations.Error.SemanticError, null); } else { var targetLabel = isContinue ? labelInfo.ContinueTarget : labelInfo.BreakTarget; bool isLeavingProtectedRegion = labelInfo.ProtectedRegion != _labelInfos.CurrProtectedRegion; if (isLeavingProtectedRegion) _ilGen.Leave(targetLabel); else _ilGen.Br(targetLabel); } }
public override void Visit(ThrowStatement node) { PushLocation(node); var stackState = _localVars.GetTemporaryStackState(); VisitNode(node.Expression); _ilGen.Call(Types.JSException.Throw.Get(_result.ValueType)); _localVars.PopTemporariesAfter(stackState); PopLocation(); }
public override void Visit(ThrowStatement node) { Visit((Statement)node); }
public override void Visit(ThrowStatement node) { VisitNode(node.Expression); Visit((Statement)node); }
protected override void Jump(GotoStatement node, bool isContinue) { var labelInfo = _labelInfos.GetLabelInfo(node.Target); string error = null; if (labelInfo == null) { if (node.Target == null) if (isContinue) error = "SyntaxError: Illegal continue statement"; else error = "SyntaxError: Illegal break statement"; else error = string.Format("SyntaxError: Undefined label '{0}'", node.Target); } else if (isContinue && !labelInfo.HasContinueTarget) error = string.Format("SyntaxError: Undefined label '{0}'", node.Target); if (error != null) { var tmpException = new ThrowStatement(new StringLiteral(error)); VisitNode(tmpException); //We call visit here to have the proper override of it get called. //TODO: var ErrorCall = new InternalCall(CodeGen.Types.Operations.Error.SemanticError, null); } else { //We reserve one slot in the _ics and later back fill these jumps. (isContinue ? labelInfo.ContinueTarget : labelInfo.BreakTarget).AddLast(ReserveNewICIndex()); } }
public override void Visit(ThrowStatement node) { PushLocation(node); VisitNode(node.Expression); BeginICMethod(node); _ilGen.LoadValue(_stackModel.StackPointer - 1); _ilGen.Call(Types.JSException.Throw.Get(mdr.ValueTypes.DValueRef)); EndICMethod(); _stackModel.Pop(1); PopLocation(); }
public abstract void Visit(ThrowStatement node);
public override void Visit(ThrowStatement node) { PushLocation(node); VisitNode(node.Expression); Call(Types.Operations.Stack.Throw, 1, 0); PopLocation(); }
public override void Visit(ThrowStatement node) { throw new NotImplementedException(); }
public override void Visit(ThrowStatement node) { }