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

Infinite loop when trying to write a for-loop #16

Closed
jglick opened this issue Jun 3, 2014 · 3 comments
Closed

Infinite loop when trying to write a for-loop #16

jglick opened this issue Jun 3, 2014 · 3 comments

Comments

@jglick
Copy link
Member

jglick commented Jun 3, 2014

for (int i = 0; i < array.length; i++) {…}

works (with or without the sandbox) but

for (i = 0; i < array.length; i++) {…}

loops endlessly in the sandbox, with i always 0.

jglick added a commit to jenkinsci/script-security-plugin that referenced this issue Jun 3, 2014
@kohsuke
Copy link
Member

kohsuke commented Oct 28, 2014

The problem here is that i++ for local variable i is handled correctly, but i++ for property i isn't.

@kohsuke
Copy link
Member

kohsuke commented Oct 28, 2014

The underlying issue I'm uncovering is that the semantics of postfix operator i++ cannot be properly preserved with local transformation of an expression.

Given a++, I need to basically do something like {b=a,a=a.next(),b} so that the whole expression evaluates to the value prior to increment, but how do I do that!?

@kohsuke
Copy link
Member

kohsuke commented Oct 28, 2014

By using literal list support, I think [a,a=a.next()][0] would do

kohsuke added a commit that referenced this issue Oct 28, 2014
Made the prefix/postfix operator work correctly
@kohsuke kohsuke closed this as completed Oct 28, 2014
jglick added a commit to jenkinsci/script-security-plugin that referenced this issue Oct 28, 2014
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

2 participants