• jkummerow's avatar
    [js2c] Fix ordering issue of TextMacro expansion · 95db63ab
    jkummerow authored
    If a key is a substring of an earlier value, then the earlier value
    will unintentionally be clobbered. For example with:
      macro SET_PRIVATE(obj, sym, val) = (obj[sym] = val);
      SET_PRIVATE(iterator, arrayIteratorObjectSymbol, object);
    if the mapping is:
      {'val': 'object',
       'obj': 'iterator',
       'sym': 'arrayIteratorObjectSymbol'}
    then 'obj' -> 'iterator' will clobber 'val' -> 'object', resulting in
    'val' -> 'iteratorect'. To fix this, replace all substitutions
    simultaneously.
    
    Patch from Zoe Clifford <zoeclifford@google.com>
    
    Review-Url: https://codereview.chromium.org/2249873004
    Cr-Commit-Position: refs/heads/master@{#38665}
    95db63ab
js2c.py 18.8 KB