mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
perf(core): generate arrow functions for pure function calls (#51668)
Reworks the pure functions to use arrow functions with an implicit return instead of function expressions. This allows us to shave off some bytes for each pure function, because we can avoid some of the syntax. PR Close #51668
This commit is contained in:
committed by
Jessica Janiuk
parent
8ad21ccfb8
commit
88a0af64fd
+3
-3
@@ -1,6 +1,6 @@
|
||||
const $c0$ = function () { return { foo: null }; };
|
||||
const $c1$ = function () { return []; };
|
||||
const $c2$ = function (a0) { return { foo: a0 }; };
|
||||
const $c0$ = () => ({ foo: null });
|
||||
const $c1$ = () => [];
|
||||
const $c2$ = a0 => ({ foo: a0 });
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const $c0$ = function () { return []; };
|
||||
const $c1$ = function () { return [0, 1, 2]; };
|
||||
const $c0$ = () => [];
|
||||
const $c1$ = () => [0, 1, 2];
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const $c0$ = function () { return {}; };
|
||||
const $c1$ = function () { return { a: 1, b: 2 }; };
|
||||
const $c0$ = () => ({});
|
||||
const $c1$ = () => ({ a: 1, b: 2 });
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
const $c0$ = function () { return { foo: null }; };
|
||||
const $c1$ = function () { return {}; };
|
||||
const $c2$ = function (a0) { return { foo: a0 }; };
|
||||
const $c0$ = () => ({ foo: null });
|
||||
const $c1$ = () => ({});
|
||||
const $c2$ = a0 => ({ foo: a0 });
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const $c0$ = function () { return { foo: null }; };
|
||||
const $c1$ = function (a0) { return { foo: a0 }; };
|
||||
const $c0$ = () => ({ foo: null });
|
||||
const $c1$ = a0 => ({ foo: a0 });
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
const $c0$ = function ($a0$) {
|
||||
return [$a0$, 1, 2, 3, 4, 5];
|
||||
};
|
||||
const $c0$ = $a0$ => [$a0$, 1, 2, 3, 4, 5];
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const $e0_ff$ = function ($v$) { return ["Nancy", $v$]; };
|
||||
const $e0_ff$ = $v$ => ["Nancy", $v$];
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
const $e0_ff$ = function ($v0$, $v1$, $v2$, $v3$, $v4$, $v5$, $v6$, $v7$, $v8$) {
|
||||
return ["start-", $v0$, $v1$, $v2$, $v3$, $v4$, "-middle-", $v5$, $v6$, $v7$, $v8$, "-end"];
|
||||
}
|
||||
const $e0_ff$ = ($v0$, $v1$, $v2$, $v3$, $v4$, $v5$, $v6$, $v7$, $v8$) => ["start-", $v0$, $v1$, $v2$, $v3$, $v4$, "-middle-", $v5$, $v6$, $v7$, $v8$, "-end"];
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
const $c0$ = function () { return {opacity: 0, duration: 0}; };
|
||||
const $e0_ff$ = function ($v$) { return {opacity: 1, duration: $v$}; };
|
||||
const $e0_ff_1$ = function ($v1$, $v2$) { return [$v1$, $v2$]; };
|
||||
const $e0_ff_2$ = function ($v1$, $v2$) { return {animation: $v1$, actions: $v2$}; };
|
||||
const $c0$ = () => ({opacity: 0, duration: 0});
|
||||
const $e0_ff$ = $v$ => ({opacity: 1, duration: $v$});
|
||||
const $e0_ff_1$ = ($v1$, $v2$) => [$v1$, $v2$];
|
||||
const $e0_ff_2$ = ($v1$, $v2$) => ({animation: $v1$, actions: $v2$});
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const $e0_ff$ = function ($v$) { return {"duration": 500, animation: $v$}; };
|
||||
const $e0_ff$ = $v$ => ({"duration": 500, animation: $v$});
|
||||
// ...
|
||||
MyApp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: MyApp,
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
const $_c0$ = function (a0, a1) { return { collapsedHeight: a0, expandedHeight: a1 }; };
|
||||
const $_c1$ = function (a0, a1) { return { value: a0, params: a1 }; };
|
||||
const $_c2$ = function (a0, a1) { return { collapsedWidth: a0, expandedWidth: a1 }; };
|
||||
const $_c0$ = (a0, a1) => ({ collapsedHeight: a0, expandedHeight: a1 });
|
||||
const $_c1$ = (a0, a1) => ({ value: a0, params: a1 });
|
||||
const $_c2$ = (a0, a1) => ({ collapsedWidth: a0, expandedWidth: a1 });
|
||||
…
|
||||
hostVars: 14,
|
||||
hostBindings: function MyComponent_HostBindings(rf, ctx) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
const $ff$ = function ($v$) { return ["red", $v$]; };
|
||||
const $ff$ = $v$ => ["red", $v$];
|
||||
…
|
||||
HostBindingComp.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
|
||||
type: HostBindingComp,
|
||||
|
||||
Reference in New Issue
Block a user