Community
Participate
Working Groups
CompilationUnit::getMessages() returns Messages, which is a useful feature however, to properly display the problems in the ui i need not only source position but also the length. Messages are created from IProblems - so it should be not a big problem alternatively, they could have pointers to IProblems they originated from (which would be more flexible - it'd give me error codes).
forgot to point directly to Olivier
I recommend adding Messages.length, and not exposing the underlying IProblems.
We don't want to expose the fact that a compiler is running underneath. So we will simply add a getLength() method on the Message class. We might want to rename the getSourcePosition() to getStartPosition() to be more consistent with the ASTNode APIs. getLength() will have a meaning only if getSourcePosition() is different from -1. Is this fine for you?
yes, although removing the method altogether and introducing IProblem[] CompilationUnit::getProblems() would be much better (IProblems are light-weight, don't hold on to any internal stuff, have more useful info and you have them anyway - and create Messages from them) (and then you could simply remove that Message class that is merely a subset of IProblem) but, like i said, getLength() on Message will do fine renaming is ok too - please deprecate first
Fixed and released in HEAD.