Bug 40474 - DOM/AST: Add API to parse only part of a compilation
Summary: DOM/AST: Add API to parse only part of a compilation
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-18 11:35 EDT by Olivier Thomann CLA
Modified: 2003-08-28 04:48 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2003-07-18 11:35:41 EDT
It could be useful to be able to create only a subpart of a compilation unit
instead of the whole compilation unit when the user knows that the interesting
part is located in a method.
In this case only this method should have its statement created in the resulting
DOM/AST.
Comment 1 Olivier Thomann CLA 2003-07-18 11:37:10 EDT
Suggested API on org.eclipse.jdt.core.dom.AST:
public static CompilationUnit parsePartialCompilationUnit(		ICompilationUnit unit,
int position,
boolean resolveBindings)

public static CompilationUnit parsePartialCompilationUnit(
	ICompilationUnit unit,
	int position,
	boolean resolveBindings,
	WorkingCopyOwner owner)

Comment 2 Olivier Thomann CLA 2003-07-18 11:37:28 EDT
Changed milestone.
Comment 3 Olivier Thomann CLA 2003-07-18 12:44:32 EDT
Jim, could you please review the javadoc? When done, please reassign it to me
and I will close it.

Regression tests added.
Comment 4 Jim des Rivieres CLA 2003-07-24 16:29:36 EDT
Made minor improvements to wording of spec. Dirk or Martin should review to
ensure this is what is needed.

Olivier: The implementation should quietly ignore source positions that are 
negative or completely out of range.

(I also added some missing owner !=null checks to the AST.parse... methods 
that take a WorkingCopyOwner.)
Comment 5 Olivier Thomann CLA 2003-07-29 13:47:27 EDT
Added bound checks.
Fixed and released in HEAD.
Regression tests added in jdt/ui tests and jdt/core dom tests.
Reopen if this is not what you wanted.
Comment 6 David Audel CLA 2003-08-28 04:48:37 EDT
Verified.