File tree Expand file tree Collapse file tree
babel-parser/src/tokenizer
scripts/parser-tests/test262 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ function descriptorToConfig(
7979 // If the unloaded descriptor is a function, i.e. `plugins: [ require("my-plugin") ]`,
8080 // we print the first 50 characters of the function source code and hopefully we can see
8181 // `name: 'my-plugin'` in the source
82- name = `[Function: ${ d . value . toString ( ) . substr ( 0 , 50 ) } ... ]` ;
82+ name = `[Function: ${ d . value . toString ( ) . slice ( 0 , 50 ) } ... ]` ;
8383 }
8484 }
8585 if ( name == null ) {
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ if (process.env.BABEL_8_BREAKING) {
176176
177177 if (
178178 JSX_TAG . test ( token . value ) &&
179- ( text [ offset - 1 ] === "<" || text . substr ( offset - 2 , 2 ) == "</" )
179+ ( text [ offset - 1 ] === "<" || text . slice ( offset - 2 , offset ) == "</" )
180180 ) {
181181 return "jsxIdentifier" ;
182182 }
Original file line number Diff line number Diff line change @@ -1606,7 +1606,7 @@ export default class Tokenizer extends CommentsParser {
16061606 - 1 ,
16071607 ) ;
16081608 const match = this . input
1609- . substr ( this . state . pos - 1 , 3 )
1609+ . slice ( this . state . pos - 1 , this . state . pos + 2 )
16101610 . match ( / ^ [ 0 - 7 ] + / ) ;
16111611
16121612 // This is never null, because of the if condition above.
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ const runner = new TestRunner({
170170
171171 for await ( const test of stream ) {
172172 // strip test/
173- const fileName = test . file . substr ( 5 ) ;
173+ const fileName = test . file . slice ( 5 ) ;
174174
175175 if ( ignoredTests . some ( start => fileName . startsWith ( start ) ) ) continue ;
176176
You can’t perform that action at this time.
0 commit comments