java - Traversing through the AST node -


I want to find the line number where a call is referenced in a package using the AST API. How can I do this?

You have a compilation in which to find a CompilationUnit method:

  for (ICompilationUnit unit: mypackage.getCompilationUnits ()) {IType [] type = unit.getTypes (); (Int i = 0; i & lt; types.length; i ++) {ITIP type = type [i]; IMTP [] methods = type.getmolls ();  
  • If the method is one, then you can use the ASTNode.getStartPosition () function.
  • If the compilation unit that is an IMember one, you can use it in CompilationUnit.getLineNumber (status)
You can.

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -