Skip to content

Commit

Permalink
contentOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Nov 4, 2017
1 parent b2b798b commit 5e49d82
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/program/types/Literal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default class Literal extends Node {
if ( transforms.numericLiteral ) {
const leading = this.raw.slice( 0, 2 );
if ( leading === '0b' || leading === '0o' ) {
code.overwrite( this.start, this.end, String( this.value ), { storeName: true });
code.overwrite( this.start, this.end, String( this.value ), {
storeName: true,
contentOnly: true
});
}
}

Expand All @@ -22,7 +25,9 @@ export default class Literal extends Node {

if ( transforms.stickyRegExp && /y/.test( flags ) ) throw new CompileError( 'Regular expression sticky flag is not supported', this );
if ( transforms.unicodeRegExp && /u/.test( flags ) ) {
code.overwrite( this.start, this.end, `/${rewritePattern( pattern, flags )}/${flags.replace( 'u', '' )}` );
code.overwrite( this.start, this.end, `/${rewritePattern( pattern, flags )}/${flags.replace( 'u', '' )}`, {
contentOnly: true
});
}
}
}
Expand Down

0 comments on commit 5e49d82

Please sign in to comment.