Skip to content

Conversation

R32
Copy link
Contributor

@R32 R32 commented Jul 6, 2025

This gives the option to use the code generated by the compiler or not.

Compared to copying elements to a new array,
I prefer a cleaner way, Even if the V8 VM would complain: 'Bad value context for arguments value.'

function rest( name : String, args : haxe.Rest<String> ) {
#if (js_es < 6)
    var args : Array<String> = js.Syntax.code("Array.prototype.slice.call(arguments, 1)"); // overrides args
#end
    for (s in args)
        trace(name + " : " + s);
}

generated :

function rest(name) {
	var args = Array.prototype.slice.call(arguments, 1);
	var _g = 0;
	while(_g < args.length) console.log("src/Main.hx:27:",name + " : " + args[_g++]);
}

@skial skial mentioned this pull request Jul 26, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant