Beispiel #1
0
    private Position InternalSetBreakPoint(string args, bool temporary)
    {
        Debug.Assert(currentInfo != null);

        var position = commandLine.ParseBreakPoint(args);

        // This is a bit of a cheat, since we're only dealing with one script, but some classes here are prepared
        // for many - we just use the source ID of the current location. We "know" Source is not null, but the compiler
        // doesn't:
        string sourceId = currentInfo.Location.Source ?? "";

        // Jint requires *exact* breakpoint positions (line/column of the Esprima node targeted)
        // SourceManager/SourceInfo includes code for achieving that (may eventually be part of Jint API):
        position = sources.FindNearestBreakPointPosition(sourceId, position);

        engine.DebugHandler.BreakPoints.Set(new ExtendedBreakPoint(sourceId, position.Line, position.Column, temporary: temporary));

        return(position);
    }