public virtual void Visit(SwitchStmt switchStmt, object[] args) { foreach (SwitchCase switchCase in switchStmt.SwitchCaseList) { switchCase.Accept(this); } }
public void Visit(SwitchStmt switchStmt, object[] args) { RightValue value = exprProcessor.Eval(switchStmt.Expression); if (value is FloatConst) { kernel.IssueWarning(new Error(ErrorType.EqualOnFloat, switchStmt.Location)); } foreach (SwitchCase switchCase in switchStmt.SwitchCaseList) { if (!(value is FloatConst) && switchCase.Value is FloatConst) { kernel.IssueWarning(new Error(ErrorType.EqualOnFloat, switchCase.Location)); } if (switchCase.Value == null || switchCase.Value.IsEqualValueTo(value)) { kernel.RuntimeData.ScopeStack.Open(new LocalScope()); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CLOSE_LOCAL_SCOPE_FLAG); kernel.RuntimeData.InstructionStack.Push(switchCase.CaseContent); break; } } kernel.Next(); }