Currently, AST nodes only keep track of their starting position (offer, line number, and offset from line number). This patch will make AST nodes also keep track of their ending offset.
Created attachment 240566 [details] patch Here is a patch that records the end offsets for all AST nodes. It's a bit awkward that the endOffset property on Node is just an int. To be symmetric with node's position property, it should be a JSTextPosition. But because we don't need the other two fields on JSTextPosition, making it an int is more efficient.
Created attachment 240656 [details] patch
Comment on attachment 240656 [details] patch LGTM!
Created attachment 240705 [details] patch This fixes a few problems with the previous patch: 1. parseStatement should handle the case when result is null. 2. The FunctionBody and PropertyNode nodes weren't being assigned an endOffset.
landed in: http://trac.webkit.org/changeset/175396