File tree Expand file tree Collapse file tree 17 files changed +88
-15
lines changed
babel-plugin-proposal-class-properties/test/fixtures/regression/6154
babel-plugin-proposal-decorators/test/fixtures/legacy-regression/7030
babel-plugin-transform-classes/test/fixtures/regression/T7537
babel-plugin-transform-parameters/test/fixtures/regression/6057-expanded
babel-plugin-transform-typeof-symbol
babel-preset-env/test/fixtures
auto-esm-unsupported-import-unsupported
preset-options/loose-with-typeof-symbol-includes Expand file tree Collapse file tree 17 files changed +88
-15
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ const helper = (minVersion: string) => tpl => ({
12
12
13
13
helpers . typeof = helper ( "7.0.0-beta.0" ) `
14
14
export default function _typeof(obj) {
15
+ "@babel/helpers - typeof";
16
+
15
17
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16
18
_typeof = function (obj) { return typeof obj; };
17
19
} else {
Original file line number Diff line number Diff line change 1
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
2
2
3
3
function _possibleConstructorReturn ( self , call ) { if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) { return call ; } return _assertThisInitialized ( self ) ; }
4
4
Original file line number Diff line number Diff line change 1
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
2
2
3
3
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
4
4
Original file line number Diff line number Diff line change 1
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
2
2
3
3
function _possibleConstructorReturn ( self , call ) { if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) { return call ; } return _assertThisInitialized ( self ) ; }
4
4
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ var _args = _interopRequireDefault(require("utils/url/args"));
9
9
10
10
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { "default" : obj } ; }
11
11
12
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
12
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
13
13
14
14
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
15
15
Original file line number Diff line number Diff line change 19
19
},
20
20
"devDependencies" : {
21
21
"@babel/core" : " ^7.8.3" ,
22
- "@babel/helper-plugin-test-runner" : " ^7.8.3"
22
+ "@babel/helper-plugin-test-runner" : " ^7.8.3" ,
23
+ "@babel/runtime" : " ^7.8.3" ,
24
+ "@babel/runtime-corejs2" : " ^7.8.3" ,
25
+ "@babel/runtime-corejs3" : " ^7.8.3" ,
26
+ "resolve" : " ^1.15.0"
23
27
}
24
28
}
Original file line number Diff line number Diff line change @@ -36,8 +36,23 @@ export default declare(api => {
36
36
}
37
37
}
38
38
39
+ let isUnderHelper = path . findParent ( path => {
40
+ if ( path . isFunction ( ) ) {
41
+ return (
42
+ path . get ( "body.directives.0" ) ?. node . value . value ===
43
+ "@babel/helpers - typeof"
44
+ ) ;
45
+ }
46
+ } ) ;
47
+
48
+ if ( isUnderHelper ) return ;
49
+
39
50
const helper = this . addHelper ( "typeof" ) ;
40
- const isUnderHelper = path . findParent ( path => {
51
+
52
+ // TODO: This is needed for backward compatibility with
53
+ // @babel /helpers <= 7.8.3.
54
+ // Remove in Babel 8
55
+ isUnderHelper = path . findParent ( path => {
41
56
return (
42
57
( path . isVariableDeclarator ( ) && path . node . id === helper ) ||
43
58
( path . isFunctionDeclaration ( ) &&
Original file line number Diff line number Diff line change 1
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function ( obj ) { return typeof obj ; } ; } else { _typeof = function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function ( obj ) { return typeof obj ; } ; } else { _typeof = function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
2
2
3
3
( typeof Reflect === "undefined" ? "undefined" : _typeof ( Reflect ) ) === "object" ;
Original file line number Diff line number Diff line change 1
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function ( obj ) { return typeof obj ; } ; } else { _typeof = function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function ( obj ) { return typeof obj ; } ; } else { _typeof = function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
2
2
3
3
export default function ( ) {
4
4
_typeof ( { } ) === "object" ;
Original file line number Diff line number Diff line change 1
- function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function ( obj ) { return typeof obj ; } ; } else { _typeof = function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1
+ function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function ( obj ) { return typeof obj ; } ; } else { _typeof = function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
2
2
3
3
var _Symbol = foo ( ) ;
4
4
You can’t perform that action at this time.
0 commit comments