diff --git a/lib/ast.js b/lib/ast.js index 5dbdc9990..8ecabbc66 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -1586,7 +1586,7 @@ exports.Obj = Obj = (function(superclass){ continue; } if (node instanceof Prop || node instanceof Splat) { - node[name = (ref$ = node.children)[ref$.length - 1]] = chain = Chain(base, [Index(node[name].maybeKey())]); + node[name = (ref$ = node.children)[ref$.length - 1]] = chain = Chain(base, [Index(node[name].maybeKey(), symbol)]); } else { if (logic = node.getDefault()) { node = node.first; diff --git a/src/ast.ls b/src/ast.ls index 41b909b8c..da7076e73 100644 --- a/src/ast.ls +++ b/src/ast.ls @@ -1012,7 +1012,7 @@ class exports.Obj extends List continue if node.comment if node instanceof [Prop, Splat] node[name = node.children[*-1]] = - chain = Chain base, [Index node[name]maybe-key!] + chain = Chain base, [Index node[name]maybe-key!, symbol] else # `o{k or v}` => `{k: a.k or v}` node.=first if logic = node.get-default! diff --git a/test/chaining.ls b/test/chaining.ls index 04686d424..cd74e8cba 100644 --- a/test/chaining.ls +++ b/test/chaining.ls @@ -101,6 +101,7 @@ eq 42, do(0; parent.child.~method) eq 42, do(0; parent.child~"me#{'th'}od") eq 42, parent.child. ~ [\method] null eq 42, parent.child.~{method}.method! +eq 42, parent.child.~{renamed:method}.renamed! eq "42" 42~toString! compileThrows 'invalid assign' 1 'o~m=g'