/IronPython_2_0/Src/IronPython/Compiler/Ast/BreakStatement.cs
C# | 48 lines | 27 code | 7 blank | 14 comment | 3 complexity | 71d04775bf680c0b91a7bc0e248c19ec MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
- /* ****************************************************************************
- *
- * 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;
- }
- }
- }
- }