Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid increment syntax, and other small issues #26

Open
DayDun opened this issue Apr 19, 2019 · 7 comments
Open

Invalid increment syntax, and other small issues #26

DayDun opened this issue Apr 19, 2019 · 7 comments

Comments

@DayDun
Copy link

DayDun commented Apr 19, 2019

++[[]][0]

results in

++[]

which is invalid syntax.

When chained together

++[++[++[[]][0]][0]][0]

it results in

++++++[];

Expected result would be 1 and 3 respectively.

@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

This might be related as well:

function test(a) {
    ++a;
}

turns into

function test(a) {
    NaN;
}

@DayDun DayDun changed the title Invalid increment syntax Invalid increment syntax, and other small issues Apr 23, 2019
@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

function test() {
    console[a()]();
}
function test() {
    console();
}

@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

I hope this isn't too spammy lol.
Catch block gets discarded:

try {
    throw "error";
} catch(e) {
    a();
}
try {
    throw 'error';
}

@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

function a() {
	b()
}
a();
function a() {
	b()
}
undefined;

Edit: I realize this is kind of expected as the function doesn't return, but the function b could have side-effects which wouldn't be invoked in the resulting code.

@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

1 / -0

still evaluates to

-1e+400;

@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

function a(x) {
	return x.test;
}
a({});
function a(x) {
	return x.test;
}
x.test;

When the argument is an object, the call is incorrectly replaced with the argument variable outside of the scope

@DayDun
Copy link
Author

DayDun commented Apr 23, 2019

This causes an error

var c = 1;

while (c--) {
	new RegExp(c + "")
}

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

No branches or pull requests

1 participant