barefoot_js 0.32.0 → 0.33.0
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 +4 -4
- data/lib/barefoot_js/evaluator.rb +19 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7f4174e45092095b0751f372692d0d499b410b20ed189b6dade7ac17b6783ab
|
|
4
|
+
data.tar.gz: 3530953234122f800b30c570474f1d8f1983a1a20881e8048f52846c777e54b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: efe2cabddf07f58e24009f81504ee4a3000e9ed42caef5df804f2d060283410279e461e244078d2f3f9746ebd9fca505c5ca740170ac984296dd3320d3988ea9
|
|
7
|
+
data.tar.gz: 2c467d54aff8f44fbf65915c37c0e918fe5fba550cb0d9c2e8357d637a2ab9f1e25be8e894e5775a0ded6921c4323d14a0ba8c13bd8cf2a26c4c56bc980d0de3
|
|
@@ -100,8 +100,26 @@ module BarefootJS
|
|
|
100
100
|
when 'array-literal'
|
|
101
101
|
(node[:elements] || []).map { |e| evaluate(e, env) }
|
|
102
102
|
when 'object-literal'
|
|
103
|
+
# Each entry carries its own `kind` ('prop' | 'spread', #2696 Step
|
|
104
|
+
# 2) -- the same encoding the Go/Perl/Python evaluators and the raw
|
|
105
|
+
# ParsedExpr shape the eval-vectors.json golden corpus carry. A
|
|
106
|
+
# 'spread' evaluates its `expr` and shallow-merges the result's own
|
|
107
|
+
# keys (a non-Hash result -- including a null/undefined JS spread
|
|
108
|
+
# source -- is a no-op). Every hash this evaluator builds uses
|
|
109
|
+
# SYMBOL keys (`read_property` below always looks up `key.to_sym`),
|
|
110
|
+
# so a spread's keys are symbolized on merge for the same reason a
|
|
111
|
+
# `prop` key already is, regardless of whether the spread source's
|
|
112
|
+
# own keys started out as symbols or strings. Later entries win on
|
|
113
|
+
# a shared key, in source order, matching JS object-spread exactly.
|
|
103
114
|
out = {}
|
|
104
|
-
(node[:properties] || []).each
|
|
115
|
+
(node[:properties] || []).each do |prop|
|
|
116
|
+
if (prop[:kind] || '') == 'spread'
|
|
117
|
+
spread = evaluate(prop[:expr], env)
|
|
118
|
+
spread.each { |k, v| out[k.to_sym] = v } if spread.is_a?(Hash)
|
|
119
|
+
next
|
|
120
|
+
end
|
|
121
|
+
out[prop[:key].to_sym] = evaluate(prop[:value], env)
|
|
122
|
+
end
|
|
105
123
|
out
|
|
106
124
|
when 'array-method'
|
|
107
125
|
args = node[:args] || []
|