teptris 0.2.29-aarch64-linux → 0.2.30-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 477a02cb5a2389ff022cbb1b6589e4a684b11b29836afac63e6e9e6e85bc622f
4
- data.tar.gz: 057a9b7e89921edc84147357d44d8844155a9e79a1fc54f84a9151a9ac32bc12
3
+ metadata.gz: '059989b3fe2865a88701cd0f3fa6017e6a7d1858d9f1f4acb92b775a6678002b'
4
+ data.tar.gz: 83c5727792a555111b7e9d8fe48d3250022b5b8fed521930973f57b4c60f5add
5
5
  SHA512:
6
- metadata.gz: f77168573b78bcbc4b4051c74e7be7296ff42b4727eea93fc91c48711698e7013143401a18e8b4eac539d56f5087d05e3deeb0eb1216e4852f25f3370f4ae9b0
7
- data.tar.gz: e489a2f3b3eb893126ab803c539eb7e2df63da5fc38850d83cf4ffd4377fc3d044b7ac6abb6fe92a234b9d4378907a023e97cfa91b56904517a12cae91904317
6
+ metadata.gz: 5bc284eabb37a3f900fae5acb85f4ab84e7400d28bc2bfc1088cd3744026c310dfc2feba6bcb547ad285976897ea3109f2323bf14b5f94683f217a0c3c4300ba
7
+ data.tar.gz: 8e3395e4e6543dea2d6dd0409bd8caa4768bad3a8c21298874b5c2e5f3f17ae6a616e7737cf32ea28aee4a8c34e4996b35d5f399dd5d9c927c14bb0af64a1e95
@@ -27,11 +27,35 @@ class Teptris::Descriptor
27
27
  attr_reader :rows, :first_row
28
28
 
29
29
  def self.build(tree)
30
- rows = []
31
- first_row = [0] # plan 0 = the root: asm walks plan index 0
32
- counter = [0]
33
- compile(tree, rows, first_row, counter)
34
- first_row << rows.length # sentinel: end of the last plan's rows
30
+ # Pre-order plan numbering (root = plan 0) with each plan's rows
31
+ # assigned a DISJOINT reserved range. Interleaved appending leaks
32
+ # siblings that follow a :nested child into the sub-plan's range —
33
+ # the 0.2.29 bug (every array-of-tables element grew stray nil
34
+ # rows).
35
+ plans = []
36
+ index_of = {}
37
+ collect = lambda do |t|
38
+ unless index_of.key?(t.object_id)
39
+ index_of[t.object_id] = plans.length
40
+ plans << t
41
+ end
42
+ (t[:children] || []).each do |ch|
43
+ collect.call(ch[:plan]) if KINDS.fetch(ch[:kind]) == 3
44
+ end
45
+ end
46
+ collect.call(tree)
47
+
48
+ first_row = [0]
49
+ plans.each { |t| first_row << first_row[-1] + (t[:children] || []).length }
50
+ rows = Array.new(first_row[-1])
51
+ plans.each_with_index do |t, i|
52
+ (t[:children] || []).each_with_index do |ch, j|
53
+ kind = KINDS.fetch(ch[:kind])
54
+ sub = kind == 3 ? index_of[ch[:plan].object_id] : 0
55
+ rows[first_row[i] + j] = [ch[:name].to_s, kind, sub]
56
+ end
57
+ end
58
+
35
59
  d = allocate
36
60
  d.instance_variable_set(:@rows, rows.freeze)
37
61
  d.instance_variable_set(:@first_row, first_row.freeze)
@@ -40,30 +64,6 @@ class Teptris::Descriptor
40
64
  d.freeze
41
65
  end
42
66
 
43
- # Pre-order: each plan's rows are one CONTIGUOUS block; nested
44
- # sub-plans are compiled after the parent's block starts and their
45
- # indices patch the parent's NESTED rows. first_row must eventually
46
- # carry plan_count + 1 entries (the sentinel is rows.length).
47
- def self.compile(tree, rows, first_row, counter)
48
- idx = counter[0]
49
- counter[0] += 1
50
- first_row[idx] = rows.length
51
- (tree[:children] || []).each do |ch|
52
- kind = KINDS.fetch(ch[:kind])
53
- if kind == 3
54
- sub = counter[0]
55
- pos = rows.length
56
- rows << nil # patched with the real sub index below
57
- sub = compile(ch[:plan], rows, first_row, counter)
58
- rows[pos] = [ch[:name].to_s, kind, sub]
59
- else
60
- rows << [ch[:name].to_s, kind, 0]
61
- end
62
- end
63
- idx
64
- end
65
- private_class_method :compile
66
-
67
67
  def walk(toml)
68
68
  TeptrisExt.plan_emit(@handle, toml)
69
69
  end
@@ -1,3 +1,3 @@
1
1
  module Teptris
2
- VERSION = "0.2.29"
2
+ VERSION = "0.2.30"
3
3
  end
data/lib/teptris_ext.so CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.29
4
+ version: 0.2.30
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - teptris contributors