RESOLVED FIXED138143
AST Nodes should keep track of their end offset
https://bugs.webkit.org/show_bug.cgi?id=138143
Summary AST Nodes should keep track of their end offset
Saam Barati
Reported 2014-10-28 12:08:39 PDT
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.
Attachments
patch (6.48 KB, patch)
2014-10-28 13:09 PDT, Saam Barati
no flags
patch (7.63 KB, patch)
2014-10-29 21:22 PDT, Saam Barati
fpizlo: review+
patch (10.76 KB, patch)
2014-10-30 15:05 PDT, Saam Barati
fpizlo: review+
Saam Barati
Comment 1 2014-10-28 13:09:56 PDT
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.
Saam Barati
Comment 2 2014-10-29 21:22:53 PDT
Filip Pizlo
Comment 3 2014-10-29 21:37:56 PDT
Comment on attachment 240656 [details] patch LGTM!
Saam Barati
Comment 4 2014-10-30 15:05:00 PDT
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.
Saam Barati
Comment 5 2014-10-30 16:51:24 PDT
Note You need to log in before you can comment on or make changes to this bug.