• Leszek Swirski's avatar
    [liveedit] Fix patching functions with start position zero · e8c5a51c
    Leszek Swirski authored
    For a script '()=>42', the anonymous arrow function has both start and
    end position the same as the script function itself. This causes issues
    when sorting the SourcePositionEvents of the function, in two ways:
    
      * If the start positions are the same, we should order by *furthest*
        end position to ensure the stack is in the right order
      * If both start and end are the same, we need to order by function
        literal id to make sure that start order and end order are inversed.
    
    Also, MapLiterals assumes that start+end position uniquely identifies a
    function, which is false in this case, so we process the top-level
    script function separately in MapLiterals.
    
    Change-Id: I2b2185dc2825018b7ea44c7d0918238e9b1dd972
    Reviewed-on: https://chromium-review.googlesource.com/1141741
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#54525}
    e8c5a51c
liveedit.cc 46.4 KB