Skip to content

Minify more type constructors - #45

Merged
kangax merged 3 commits into
masterfrom
minify-more-type-constructors
Jul 12, 2016
Merged

kangax merged 3 commits into
masterfrom
minify-more-type-constructors

Conversation

@fregante

@fregante fregante commented Jul 10, 2016 •

Copy link
Copy Markdown
Contributor

@fregante fregante mentioned this pull request Jul 10, 2016
2 of 4 tasks
(function (Boolean, String, Number) {
return Boolean(a), String(b), Number(c);
})(MyBoolean, MyString, MyNumber);
(function (Boolean, String, Number, Object) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Array?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you're testing for local binding so we should just add it here to the test.

@fregante fregante Jul 10, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, missed that. I squashed the commits in a sensible way and added Array there.

@fregante
fregante force-pushed the minify-more-type-constructors branch 2 times, most recently from 0172071 to 31891f6 Compare July 10, 2016 08:44
@fregante
fregante force-pushed the minify-more-type-constructors branch from 31891f6 to 9a84e1b Compare July 10, 2016 08:47
@fregante
fregante force-pushed the minify-more-type-constructors branch from 3a97a11 to e8016c3 Compare July 10, 2016 10:13
@fregante
fregante force-pushed the minify-more-type-constructors branch from e8016c3 to e5a2d37 Compare July 10, 2016 12:29
expect(transform(source)).toBe(expected);
});

it("should turn Array(number) to [,] only if number is <=6", () => {

@fregante fregante Jul 10, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue here is oldIE: [,].length is 2 in IE8- and 1 everywhere else.

Specifically, none of these work correctly there:

Array(1);
Array(2);
Array(3);
Array(4);
Array(5);
Array(6);

Are you going to support IE8 anywhere else?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's worth supporting IE8. But we need to at least mention this in the docs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote we document it for now, we could always have a separate transform to run through and pick out stuff like this that IE would choke on.

@kangax
kangax merged commit d627c33 into master Jul 12, 2016
@kangax

kangax commented Jul 12, 2016

Copy link
Copy Markdown
Member

We need to also figure out how to denote plugins as safe (always identical functionality) or unsafe (identical functionality in most cases but not always). The Array => [] and all that would have to be marked as unsafe transformations.

@hzoo
hzoo deleted the minify-more-type-constructors branch July 12, 2016 22:15
@fregante

Copy link
Copy Markdown
Contributor Author

Unsafe in IE8- only, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants