Sha256: f583929ad3bc88882c079765c542d5da22a125abd1e3e06fcf952ead5a15ecff

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

module Byebug::DAP
  class Command::Evaluate < Command
    # "Evaluates the given expression in the context of the top most stack frame.
    # "The expression has access to any variables and arguments that are in scope.

    include ValueHelpers

    register!

    def execute
      started!

      respond! body: evaluate
    end

    private

    def evaluate
      return prepare_value_response(0, 0, :evaluate) { TOPLEVEL_BINDING.eval(args.expression) } unless args.frameId

      frame, thnum, frnum = resolve_frame_id(args.frameId)
      return unless frame

      prepare_value_response(thnum, frnum, :evaluate) { frame._binding.eval(args.expression) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
byebug-dap-0.1.4 lib/byebug/dap/commands/evaluate.rb
byebug-dap-0.1.3 lib/byebug/dap/commands/evaluate.rb