MegaBites-AI/Windows-powershell
0372
1/* ****************************************************************************2 *3 * Copyright (c) Microsoft Corporation.4 *5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A6 * copy of the license can be found in the License.html file at the root of this distribution. If7 * you cannot locate the Apache License, Version 2.0, please send an email to8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound9 * by the terms of the Apache License, Version 2.0.10 *11 * You must not remove this notice, or any other, from this software.12 *13 *14 * ***************************************************************************/15 16namespace System.Management.Automation.Interpreter17{18 internal sealed class UpdatePositionInstruction : Instruction19 {20 private readonly int _sequencePoint;21 private readonly bool _checkBreakpoints;22 23 private UpdatePositionInstruction(bool checkBreakpoints, int sequencePoint)24 {25 _checkBreakpoints = checkBreakpoints;26 _sequencePoint = sequencePoint;27 }28 29 public override int Run(InterpretedFrame frame)30 {31 var functionContext = frame.FunctionContext;32 var context = frame.ExecutionContext;33 34 functionContext._currentSequencePointIndex = _sequencePoint;35 if (_checkBreakpoints)36 {37 if (context._debuggingMode > 0)38 {39 context.Debugger.OnSequencePointHit(functionContext);40 }41 }42 43 return +1;44 }45 46 public static Instruction Create(int sequencePoint, bool checkBreakpoints)47 {48 return new UpdatePositionInstruction(checkBreakpoints, sequencePoint);49 }50 }51}52 