~technomancy/fennel

289d55ffa4746b022e0002ffddaa326fc9638025 — Phil Hagelberg a month ago 6f64781
Change the fennelview table reference notation to use @.
3 files changed, 5 insertions(+), 5 deletions(-)

M fennelview.fnl
M fennelview.lua
M test/core.fnl
M fennelview.fnl => fennelview.fnl +2 -2
@@ 129,7 129,7 @@
(fn put-table [self t]
  (let [metamethod (and self.metamethod? (-?> t getmetatable (. :__fennelview)))]
    (if (and (already-visited? self t) self.detect-cycles?)
        (puts self "#<table " (get-id self t) ">")
        (puts self "#<table @" (get-id self t) ">")
        (>= self.level self.depth)
        (puts self "{...}")
        metamethod


@@ 141,7 141,7 @@
          ;; a table, so if it's not found, assume we haven't seen it; we can't
          ;; do cycle detection in that case.
          (when (and (< 1 (or (. self.appearances t) 0)) self.detect-cycles?)
            (puts self "<" id ">"))
            (puts self "@" id))
          (if (and (= (length non-seq-keys) 0) (= (length t) 0))
              (puts self (if self.empty-as-square "[]" "{}"))
              (= (length non-seq-keys) 0)

M fennelview.lua => fennelview.lua +2 -2
@@ 155,7 155,7 @@ local function put_table(self, t)
  end
  metamethod = (self["metamethod?"] and _1_())
  if (already_visited_3f(self, t) and self["detect-cycles?"]) then
    return puts(self, "#<table ", get_id(self, t), ">")
    return puts(self, "#<table @", get_id(self, t), ">")
  elseif (self.level >= self.depth) then
    return puts(self, "{...}")
  elseif metamethod then


@@ 164,7 164,7 @@ local function put_table(self, t)
    local non_seq_keys, len = get_nonsequential_keys(t)
    local id = get_id(self, t)
    if ((1 < (self.appearances[t] or 0)) and self["detect-cycles?"]) then
      puts(self, "<", id, ">")
      puts(self, "@", id)
    end
    if ((#non_seq_keys == 0) and (#t == 0)) then
      local function _3_()

M test/core.fnl => test/core.fnl +1 -1
@@ 303,7 303,7 @@
  (let [cases {"((require :fennelview) (let [t {}] [t t]) {:detect-cycles? false})"
               "[{} {}]"
               "((require :fennelview) (let [t {}] [t t]))"
               "[<2>{} #<table 2>]"
               "[@2{} #<table @2>]"
               "((require :fennelview) {:a 1 :b 52})"
               "{
  :a 1