return_undefined: { options = { booleans: true, comparisons: true, conditionals: true, dead_code: true, drop_debugger: true, evaluate: true, hoist_funs: true, hoist_vars: true, if_return: true, join_vars: true, keep_fargs: true, keep_fnames: false, loops: true, negate_iife: true, properties: true, sequences: false, side_effects: true, unused: true, } input: { function f0() { } function f1() { return undefined; } function f2() { return void 0; } function f3() { return void 123; } function f4() { return; } function f5(a, b) { console.log(a, b); baz(a); return; } function f6(a, b) { console.log(a, b); if (a) { foo(b); baz(a); return a + b; } return undefined; } function f7(a, b) { console.log(a, b); if (a) { foo(b); baz(a); return void 0; } return a + b; } function f8(a, b) { foo(a); bar(b); return void 0; } function f9(a, b) { foo(a); bar(b); return undefined; } function f10() { return false; } function f11() { return null; } function f12() { return 0; } } expect: { function f0() {} function f1() {} function f2() {} function f3() {} function f4() {} function f5(a, b) { console.log(a, b); baz(a); } function f6(a, b) { console.log(a, b); if (a) { foo(b); baz(a); return a + b; } } function f7(a, b) { console.log(a, b); if (!a) return a + b; foo(b); baz(a); } function f8(a, b) { foo(a); bar(b); } function f9(a, b) { foo(a); bar(b); } function f10() { return !1; } function f11() { return null; } function f12() { return 0; } } } return_void: { options = { if_return: true, inline: true, reduce_vars: true, unused: true, } input: { function f() { function g() { h(); } return g(); } } expect: { function f() { h(); } } } >2023-06-04records: Add MATCH-RECORD-LAMBDA....* guix/records.scm (match-record-lambda): New syntax. * tests/records.scm ("match-record-lambda"): New test. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> (unmatched-parenthesis ew syntax 2023-06-04records: match-record: Support thunked and delayed fields....* guix/records.scm (match-record): Unwrap matched thunked and delayed fields. * tests/records.scm ("match-record, thunked field", "match-record, delayed field"): New tests. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> (unmatched-parenthesis d 2022-12-27records: match-record supports specifying a different variable name....An example: (match-record obj <my-type> (field1 (field2 custom-var-name) field3) ...) * guix/records.scm (match-record-inner): Add support for the new syntax. * tests/records.scm ("match-record, simple"): Add a simple test case for the new syntax. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Attila Lendvai 2022-12-02records: 'match-record' checks fields at macro-expansion time....This allows 'match-record' to be more efficient (field offsets are computed at compilation time) and to report unknown fields at macro-expansion time. * guix/records.scm (map-fields): New macro. (define-record-type*)[rtd-identifier]: New procedure. Define TYPE as a macro and use a separate identifier for the RTD. (lookup-field, match-record-inner): New macros. (match-record): Rewrite in terms of 'match-error-inner'. * tests/records.scm ("match-record, simple") ("match-record, unknown field"): New tests. * gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file' local variable to 'main-log-file'. * gnu/services/getmail.scm (serialize-getmail-configuration-file): Move after <getmail-configuration-file> definition. Ludovic Courtès 2022-07-01tests: Add sanitizer test....* tests/records.scm ("define-record-type* & sanitize without default value"): New test. Ludovic Courtès 2021-08-12records: Support field sanitizers....* guix/records.scm (make-syntactic-constructor): Add #:sanitizers. [field-sanitizer]: New procedure. [wrap-field-value]: Honor F's sanitizer. (define-record-type*)[field-sanitizer]: New procedure. Pass #:sanitizer to 'make-syntactic-constructor'. * tests/records.scm ("define-record-type* & sanitize") ("define-record-type* & sanitize & thunked"): New tests. Ludovic Courtès