/IronPython_2_0/Src/IronPython/Compiler/Ast/BreakStatement.cs
# · C# · 48 lines · 27 code · 7 blank · 14 comment · 3 complexity · 71d04775bf680c0b91a7bc0e248c19ec MD5 · raw file
- /* ****************************************************************************
- *
- * Copyright (c) Microsoft Corporation.
- *
- * This source code is subject to terms and conditions of the Microsoft Public License. A
- * copy of the license can be found in the License.html file at the root of this distribution. If
- * you cannot locate the Microsoft Public License, please send an email to
- * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
- * by the terms of the Microsoft Public License.
- *
- * You must not remove this notice, or any other, from this software.
- *
- *
- * ***************************************************************************/
- using System; using Microsoft;
-
-
- using AstUtils = Microsoft.Scripting.Ast.Utils;
- using MSAst = Microsoft.Linq.Expressions;
-
- namespace IronPython.Compiler.Ast {
-
- public class BreakStatement : Statement {
- public BreakStatement() {
- }
-
- internal override MSAst.Expression Transform(AstGenerator ag) {
- if (ag.InLoop) {
- return AstUtils.Break(ag.BreakLabel, Span);
- } else {
- ag.AddError("'break' outside loop", Span);
- return null;
- }
- }
-
- public override void Walk(PythonWalker walker) {
- if (walker.Walk(this)) {
- }
- walker.PostWalk(this);
- }
-
- internal override bool CanThrow {
- get {
- return false;
- }
- }
- }
- }