Skip to content

Commit

Permalink
Do not change function arity while transforming. Closes #1331
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Feb 4, 2023
1 parent 8dc5fc2 commit 6268e5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def_transform(AST_Destructuring, function(self, tw) {

def_transform(AST_Lambda, function(self, tw) {
if (self.name) self.name = self.name.transform(tw);
self.argnames = do_list(self.argnames, tw);
self.argnames = do_list(self.argnames, tw, /* allow_splicing */ false);
if (self.body instanceof AST_Node) {
self.body = self.body.transform(tw);
} else {
Expand All @@ -214,7 +214,7 @@ def_transform(AST_Lambda, function(self, tw) {

def_transform(AST_Call, function(self, tw) {
self.expression = self.expression.transform(tw);
self.args = do_list(self.args, tw);
self.args = do_list(self.args, tw, /* allow_splicing */ false);
});

def_transform(AST_Sequence, function(self, tw) {
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ function return_this() { return this; }
function return_null() { return null; }

var MAP = (function() {
function MAP(a, tw) {
function MAP(a, tw, allow_splicing = true) {
// Loop but try not to build a new array
for (let i = 0; i < a.length; ++i) {
let item = a[i];
let ret = item.transform(tw, true);
let ret = item.transform(tw, allow_splicing);

if (ret !== item) {
const a1 = a.slice(0, i);
Expand Down

0 comments on commit 6268e5f

Please sign in to comment.