Commit dc037415 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Use Util::Json also in Esprima class.

Enhance Util::Json.parse to accept an options parameter which Esprima
class needs to pass.  Now everything accesses the JSON gem through
JsDuck::Util::Json wrapper.
parent 96c2b5dd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
require 'v8'
require 'json'
require 'jsduck/util/json'
require 'jsduck/util/singleton'

module JsDuck
@@ -29,7 +29,7 @@ module JsDuck
    def parse(input)
      @v8['js'] = input
      json = @v8.eval("JSON.stringify(esprima.parse(js, {comment: true, range: true, raw: true}))")
      return JSON.parse(json, :max_nesting => false)
      return Util::Json.parse(json, :max_nesting => false)
    end

  end
+2 −2
Original line number Diff line number Diff line
@@ -50,8 +50,8 @@ module JsDuck
      end

      # Parses JSON string
      def parse(string)
        JSON.parse(string)
      def parse(string, opts = {})
        JSON.parse(string, opts)
      end

    end