Skip to content

Commit

Permalink
Improve comments generation (#14979)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
liuxingbaoyu and nicolo-ribaudo committed Oct 9, 2022
1 parent 586a7ee commit d45d59a
Show file tree
Hide file tree
Showing 2,574 changed files with 2,531 additions and 13,070 deletions.
@@ -1,6 +1,5 @@
(function (global) {
var babelHelpers = global.babelHelpers = {};

function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
Expand All @@ -10,7 +9,6 @@
Object.defineProperty(target, descriptor.key, descriptor);
}
}

function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Expand All @@ -19,6 +17,5 @@
});
return Constructor;
}

babelHelpers.createClass = _createClass;
})(typeof global === "undefined" ? self : global);
Expand Up @@ -3,6 +3,9 @@
/*
Test comment
*/

arr.map(function (x) {
return x * MULTIPLIER;
}); // END OF FILE
});

// END OF FILE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions packages/babel-core/test/api.js
Expand Up @@ -625,7 +625,6 @@ describe("api", function () {
' throw new TypeError("Cannot call a class as a function");',
" }",
"}",
"",
"let Foo = function Foo() {",
" _classCallCheck(this, Foo);",
"};",
Expand All @@ -636,7 +635,7 @@ describe("api", function () {

expect(
originalPositionFor(consumer, {
line: 7,
line: 6,
column: 4,
}),
).toEqual({
Expand Down Expand Up @@ -710,7 +709,7 @@ describe("api", function () {
],
}).then(function (result) {
expect(result.code).toBe(
"/*before*/\nstart;\n\n/*after*/\nclass Foo {}\n\n/*before*/\nend;\n\n/*after*/",
"/*before*/\nstart;\n/*after*/\nclass Foo {}\n/*before*/\nend;\n/*after*/",
);
});
});
Expand Down
@@ -1,7 +1,6 @@
function A() {
var a;
}

function B() {
var a;
}
Expand Up @@ -2,19 +2,14 @@ var Foo = /*#__PURE__*/function (_Bar) {
"use strict";

babelHelpers.inherits(Foo, _Bar);

var _super = babelHelpers.createSuper(Foo);

function Foo(options) {
babelHelpers.classCallCheck(this, Foo);
var parentOptions = {};

parentOptions.init = function () {
this;
};

return _super.call(this, parentOptions);
}

return babelHelpers.createClass(Foo);
}(Bar);
@@ -1,12 +1,10 @@
function foo() {
var input = ['a', 'b', 'c'];
var output = {};

for (var _i = 0, _input = input; _i < _input.length; _i++) {
var c = _input[_i];
var name = c;
output[name] = name;
}

return output;
}
@@ -1,7 +1,5 @@
const bug = 1;

function foo() {}

function bar() {
var bug;
bug = 2;
Expand Down
@@ -1,7 +1,6 @@
function wrapper(fn) {
return function () {
var _arguments = arguments;

var _loop = function () {
var val = fn(..._arguments);
return {
Expand All @@ -10,10 +9,8 @@ function wrapper(fn) {
})
};
};

while (someCondition) {
var _ret = _loop();

if (typeof _ret === "object") return _ret.v;
}
};
Expand Down
@@ -1,32 +1,26 @@
function f() {
var _this = this;

let g = /*#__PURE__*/function () {
var _ref = babelHelpers.asyncToGenerator(function* () {
_this;
});

return function g() {
return _ref.apply(this, arguments);
};
}();
}

class Class {
m() {
var _this2 = this;

return babelHelpers.asyncToGenerator(function* () {
var c = /*#__PURE__*/function () {
var _ref2 = babelHelpers.asyncToGenerator(function* (b) {
_this2;
});

return function c(_x) {
return _ref2.apply(this, arguments);
};
}();
})();
}

}
Expand Up @@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;

var Foo = /*#__PURE__*/function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}

babelHelpers.createClass(Foo, [{
key: "bar",
value: function () {
Expand All @@ -20,35 +18,28 @@ var Foo = /*#__PURE__*/function () {
switch (_context.prev = _context.next) {
case 0:
baz = 0;

case 1:
case "end":
return _context.stop();
}
}
}, _callee);
}));

function bar() {
return _bar.apply(this, arguments);
}

return bar;
}()
}]);
return Foo;
}();

exports["default"] = Foo;

function foo() {
return _foo.apply(this, arguments);
}

function _foo() {
_foo = babelHelpers.asyncToGenerator( /*#__PURE__*/babelHelpers.regeneratorRuntime().mark(function _callee3() {
var bar, _bar2;

return babelHelpers.regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
Expand All @@ -61,7 +52,6 @@ function _foo() {
switch (_context2.prev = _context2.next) {
case 0:
baz = {};

case 1:
case "end":
return _context2.stop();
Expand All @@ -71,11 +61,9 @@ function _foo() {
}));
return _bar2.apply(this, arguments);
};

bar = function _bar3() {
return _bar2.apply(this, arguments);
};

case 2:
case "end":
return _context3.stop();
Expand Down
@@ -1,3 +1,4 @@
{
"plugins": ["transform-arrow-functions", "transform-function-name"]
"plugins": ["transform-arrow-functions", "transform-function-name"],
"sourceMap": true
}

This file was deleted.

@@ -1,3 +1,4 @@
{
"plugins": ["transform-classes", "transform-block-scoping"]
"plugins": ["transform-classes", "transform-block-scoping"],
"sourceMap": true
}
Expand Up @@ -4,7 +4,6 @@ var Test = /*#__PURE__*/function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
}

babelHelpers.createClass(Test, [{
key: "bar",
get: function () {
Expand All @@ -13,6 +12,5 @@ var Test = /*#__PURE__*/function () {
}]);
return Test;
}();

var test = new Test();
test.bar;

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,3 +1,4 @@
{
"plugins": ["transform-modules-commonjs"]
"plugins": ["transform-modules-commonjs"],
"sourceMap": true
}
Expand Up @@ -91,13 +91,11 @@ exports.default = void 0;
//
var _default = {
name: 'HelloWorld',

data() {
return {
msg: 'Welcome to Your Vue.js App'
};
}

}; //
//
//
Expand All @@ -116,5 +114,4 @@ var _default = {
//
//
//

exports.default = _default;

0 comments on commit d45d59a

Please sign in to comment.