google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.18k stars 580 forks source link

[strong] Add arity checking to functions #1902

Closed arv closed 9 years ago

arv commented 9 years ago

In strong mode it is illegal to call a function with too few arguments.

This introduces a new option: --strong-mode-runtime which injects runtime checks as needed. This is of by default for strong mode at the moment but we can revisit the default for this later.

arv commented 9 years ago

@johnjbarton @rossberg-chromium

arv commented 9 years ago

@Pasteuriser Would you mind taking a look since Andreas is out next week.

johnjbarton commented 9 years ago

Cool to see traits example. LGTM

arv commented 9 years ago

I moved some fixes out of this and merged...

I added more tests which made me realize that we cannot check the arity for arrow functions because arrow functions do not have an arguments object.

PTAL

johnjbarton commented 9 years ago

The description option name doesn't match the source now. LGTM

arv commented 9 years ago

The description option name doesn't match the source now.

Not sure what that refers to?

I'm fine calling the option strongModeAsserts for now. We can always rename in the future.

johnjbarton commented 9 years ago

Maybe you aren't using the github descriptions for commits like I am? Anyway, I meant:

This introduces a new option: --strong-mode-runtime which injects

arv commented 9 years ago

The commit looks correct to me:

https://github.com/google/traceur-compiler/pull/1902/commits

I stopped using pulley a while ago. I just merge with --ff-only these days.