Bug 10843 - DOM/AST: wrong structure for for statements
Summary: DOM/AST: wrong structure for for statements
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-06 08:09 EST by Dirk Baeumer CLA
Modified: 2002-03-06 09:51 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2002-03-06 08:09:50 EST
Build 20020305

For the example

package validSelection;

public class A_test242 {
	public void foo() {
		/*]*/for (int i= 0; i < 10; i++)
			foo()/*]*/;
	}	
}

the new AST creates the following nodes

<for>
  ...
  <expression>...</expression>
</for>

IMO it should be

<for>
  ...
  <expression_statement>
    <expression>...</expression>
  </expression_statement>
</for>

As a result the end position of the for node doesn't include the semicolon.
Comment 1 Dirk Baeumer CLA 2002-03-06 08:14:46 EST
I assume that the while node shows the same behaviour
Comment 2 Olivier Thomann CLA 2002-03-06 08:54:37 EST
In fact this is not true. I convert the for statement to:
<for>
  ...
  
<expression_statement>
    <expression>...</expression>
  
</expression_statement>
</for>
But I simply fail in the test to retrieve the semi-colon.
Comment 3 Dirk Baeumer CLA 2002-03-06 09:10:15 EST
You are absolutly right. Sorry for the confusion.
Comment 4 Olivier Thomann CLA 2002-03-06 09:49:23 EST
Fixed and released in HEAD.