Skip to content

Commit

Permalink
fix(es/codegen): Emit type arguments of jsx element names (#7522)
Browse files Browse the repository at this point in the history
  • Loading branch information
liaoyinglong authored Jun 13, 2023
1 parent 983d2e8 commit a0da02d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/swc_ecma_codegen/src/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ where
punct!("<");
emit!(node.name);

if let Some(type_args) = &node.type_args {
emit!(type_args);
}

if !node.attrs.is_empty() {
space!();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Foo<Bar> id="foo"></Foo>;
<Foo<Bar> />;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Foo<Bar> id="foo"></Foo>;
<Foo<Bar>/>;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Foo<Bar> id="foo"></Foo><Foo<Bar>/>;

1 comment on commit a0da02d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a0da02d Previous: 3958f17 Ratio
es/full/bugs-1 362382 ns/iter (± 10397) 359138 ns/iter (± 8159) 1.01
es/full/minify/libraries/antd 1916091353 ns/iter (± 31364945) 1907064900 ns/iter (± 52379943) 1.00
es/full/minify/libraries/d3 377576489 ns/iter (± 5472133) 375283739 ns/iter (± 5150379) 1.01
es/full/minify/libraries/echarts 1488394291 ns/iter (± 19952624) 1453411230 ns/iter (± 14619877) 1.02
es/full/minify/libraries/jquery 111500116 ns/iter (± 1801640) 110026730 ns/iter (± 904286) 1.01
es/full/minify/libraries/lodash 135677345 ns/iter (± 1393366) 132681451 ns/iter (± 901642) 1.02
es/full/minify/libraries/moment 65193964 ns/iter (± 548449) 63798188 ns/iter (± 470672) 1.02
es/full/minify/libraries/react 23195684 ns/iter (± 250469) 22970210 ns/iter (± 197155) 1.01
es/full/minify/libraries/terser 301872481 ns/iter (± 5804087) 289851063 ns/iter (± 4678432) 1.04
es/full/minify/libraries/three 541153828 ns/iter (± 5879298) 535920552 ns/iter (± 6696827) 1.01
es/full/minify/libraries/typescript 3621698227 ns/iter (± 26753594) 3582652287 ns/iter (± 18123537) 1.01
es/full/minify/libraries/victory 807135252 ns/iter (± 15741302) 771738422 ns/iter (± 8331356) 1.05
es/full/minify/libraries/vue 162684684 ns/iter (± 1555408) 159040087 ns/iter (± 1342295) 1.02
es/full/codegen/es3 41185 ns/iter (± 129) 40308 ns/iter (± 128) 1.02
es/full/codegen/es5 41259 ns/iter (± 69) 40275 ns/iter (± 181) 1.02
es/full/codegen/es2015 41318 ns/iter (± 56) 40318 ns/iter (± 85) 1.02
es/full/codegen/es2016 41305 ns/iter (± 73) 40359 ns/iter (± 110) 1.02
es/full/codegen/es2017 41353 ns/iter (± 109) 40445 ns/iter (± 55) 1.02
es/full/codegen/es2018 41283 ns/iter (± 95) 40416 ns/iter (± 103) 1.02
es/full/codegen/es2019 41346 ns/iter (± 59) 40280 ns/iter (± 125) 1.03
es/full/codegen/es2020 41311 ns/iter (± 45) 40285 ns/iter (± 81) 1.03
es/full/all/es3 215538472 ns/iter (± 2341141) 214075821 ns/iter (± 2695771) 1.01
es/full/all/es5 204686645 ns/iter (± 2844796) 205202199 ns/iter (± 2297286) 1.00
es/full/all/es2015 158962833 ns/iter (± 1933175) 161521784 ns/iter (± 2096741) 0.98
es/full/all/es2016 159456915 ns/iter (± 1624156) 159320953 ns/iter (± 3349937) 1.00
es/full/all/es2017 158298718 ns/iter (± 1506890) 158445305 ns/iter (± 1184395) 1.00
es/full/all/es2018 155594361 ns/iter (± 3612315) 156253265 ns/iter (± 1467354) 1.00
es/full/all/es2019 155226768 ns/iter (± 2285104) 155346198 ns/iter (± 1581902) 1.00
es/full/all/es2020 149552370 ns/iter (± 2854429) 148927454 ns/iter (± 1364492) 1.00
es/full/parser 608081 ns/iter (± 9934) 608471 ns/iter (± 10710) 1.00
es/full/base/fixer 24836 ns/iter (± 54) 25000 ns/iter (± 59) 0.99
es/full/base/resolver_and_hygiene 105758 ns/iter (± 162) 105360 ns/iter (± 91) 1.00
serialization of serde 282 ns/iter (± 0) 282 ns/iter (± 0) 1
css/minify/libraries/bootstrap 36355423 ns/iter (± 356584) 35908315 ns/iter (± 307166) 1.01
css/visitor/compare/clone 2388199 ns/iter (± 3704) 2363027 ns/iter (± 12818) 1.01
css/visitor/compare/visit_mut_span 2586602 ns/iter (± 5632) 2579363 ns/iter (± 3457) 1.00
css/visitor/compare/visit_mut_span_panic 2669033 ns/iter (± 26604) 2650742 ns/iter (± 6682) 1.01
css/visitor/compare/fold_span 3523427 ns/iter (± 106736) 3354210 ns/iter (± 22686) 1.05
css/visitor/compare/fold_span_panic 3548968 ns/iter (± 55854) 3547479 ns/iter (± 16576) 1.00
css/lexer/bootstrap_5_1_3 5532891 ns/iter (± 24584) 5545033 ns/iter (± 9629) 1.00
css/lexer/foundation_6_7_4 4702527 ns/iter (± 3839) 4676157 ns/iter (± 7596) 1.01
css/lexer/tailwind_3_1_1 892164 ns/iter (± 1036) 888106 ns/iter (± 1827) 1.00
css/parser/bootstrap_5_1_3 23912868 ns/iter (± 85228) 23911233 ns/iter (± 129006) 1.00
css/parser/foundation_6_7_4 19033619 ns/iter (± 84422) 19029594 ns/iter (± 36932) 1.00
css/parser/tailwind_3_1_1 3685666 ns/iter (± 7093) 3671159 ns/iter (± 7560) 1.00
es/codegen/colors 735345 ns/iter (± 396694) 737230 ns/iter (± 397760) 1.00
es/codegen/large 3127745 ns/iter (± 1637899) 3119796 ns/iter (± 1629665) 1.00
es/codegen/with-parser/colors 57996 ns/iter (± 425) 56942 ns/iter (± 502) 1.02
es/codegen/with-parser/large 572867 ns/iter (± 2071) 569423 ns/iter (± 1151) 1.01
es/minify/libraries/antd 1685680890 ns/iter (± 21161731) 1650209047 ns/iter (± 21648591) 1.02
es/minify/libraries/d3 329796102 ns/iter (± 4294006) 330238261 ns/iter (± 5648908) 1.00
es/minify/libraries/echarts 1272608747 ns/iter (± 13562365) 1265191774 ns/iter (± 5978504) 1.01
es/minify/libraries/jquery 97380440 ns/iter (± 958183) 96778048 ns/iter (± 670987) 1.01
es/minify/libraries/lodash 121261696 ns/iter (± 1252408) 120626836 ns/iter (± 1162439) 1.01
es/minify/libraries/moment 56690506 ns/iter (± 469029) 56349279 ns/iter (± 339623) 1.01
es/minify/libraries/react 20494582 ns/iter (± 127145) 20502718 ns/iter (± 168824) 1.00
es/minify/libraries/terser 249704543 ns/iter (± 2288762) 251585943 ns/iter (± 1563181) 0.99
es/minify/libraries/three 450150374 ns/iter (± 6900443) 452914702 ns/iter (± 5823143) 0.99
es/minify/libraries/typescript 3181569012 ns/iter (± 41542540) 3144553167 ns/iter (± 20107565) 1.01
es/minify/libraries/victory 740282721 ns/iter (± 14039737) 675413811 ns/iter (± 7799387) 1.10
es/minify/libraries/vue 146528959 ns/iter (± 1518628) 144432275 ns/iter (± 827219) 1.01
es/visitor/compare/clone 2404077 ns/iter (± 11844) 2415054 ns/iter (± 8287) 1.00
es/visitor/compare/visit_mut_span 2791415 ns/iter (± 16225) 2804070 ns/iter (± 5512) 1.00
es/visitor/compare/visit_mut_span_panic 2849323 ns/iter (± 23823) 2848479 ns/iter (± 7772) 1.00
es/visitor/compare/fold_span 3976715 ns/iter (± 26790) 3932111 ns/iter (± 7387) 1.01
es/visitor/compare/fold_span_panic 4091717 ns/iter (± 131502) 4040003 ns/iter (± 42792) 1.01
es/lexer/colors 14805 ns/iter (± 25) 14648 ns/iter (± 26) 1.01
es/lexer/angular 6920084 ns/iter (± 1891) 6895916 ns/iter (± 13068) 1.00
es/lexer/backbone 847217 ns/iter (± 351) 843282 ns/iter (± 1519) 1.00
es/lexer/jquery 4751563 ns/iter (± 6377) 4753080 ns/iter (± 5666) 1.00
es/lexer/jquery mobile 7353122 ns/iter (± 4531) 7364122 ns/iter (± 16770) 1.00
es/lexer/mootools 3734358 ns/iter (± 4865) 3735018 ns/iter (± 1065) 1.00
es/lexer/underscore 701916 ns/iter (± 363) 697340 ns/iter (± 1255) 1.01
es/lexer/three 22355464 ns/iter (± 24663) 22246723 ns/iter (± 86336) 1.00
es/lexer/yui 4282141 ns/iter (± 4706) 4264273 ns/iter (± 13427) 1.00
es/parser/colors 33723 ns/iter (± 89) 33800 ns/iter (± 56) 1.00
es/parser/angular 17126992 ns/iter (± 120762) 16906453 ns/iter (± 79384) 1.01
es/parser/backbone 2432059 ns/iter (± 12147) 2446224 ns/iter (± 15061) 0.99
es/parser/jquery 13432445 ns/iter (± 189636) 13335312 ns/iter (± 121120) 1.01
es/parser/jquery mobile 21292495 ns/iter (± 316226) 20654929 ns/iter (± 140416) 1.03
es/parser/mootools 10036239 ns/iter (± 33271) 10083823 ns/iter (± 33038) 1.00
es/parser/underscore 2074270 ns/iter (± 12145) 2083733 ns/iter (± 14812) 1.00
es/parser/three 60141888 ns/iter (± 930192) 59497653 ns/iter (± 783215) 1.01
es/parser/yui 10213732 ns/iter (± 61609) 10249447 ns/iter (± 61579) 1.00
es/preset-env/usage/builtin_type 153746 ns/iter (± 33848) 153501 ns/iter (± 34229) 1.00
es/preset-env/usage/property 29928 ns/iter (± 41) 28643 ns/iter (± 87) 1.04
es/resolver/typescript 128362342 ns/iter (± 2740605) 125036082 ns/iter (± 2840973) 1.03
es/fixer/typescript 87464985 ns/iter (± 1451632) 85089468 ns/iter (± 2242102) 1.03
es/hygiene/typescript 201346083 ns/iter (± 1563609) 194254988 ns/iter (± 1350260) 1.04
es/resolver_with_hygiene/typescript 404285960 ns/iter (± 5582976) 411917437 ns/iter (± 2555078) 0.98
es/visitor/base-perf/module_clone 85855 ns/iter (± 502) 85279 ns/iter (± 541) 1.01
es/visitor/base-perf/fold_empty 95135 ns/iter (± 559) 94999 ns/iter (± 183) 1.00
es/visitor/base-perf/fold_noop_impl_all 95603 ns/iter (± 486) 95118 ns/iter (± 512) 1.01
es/visitor/base-perf/fold_noop_impl_vec 96192 ns/iter (± 468) 95808 ns/iter (± 246) 1.00
es/visitor/base-perf/boxing_boxed_clone 60 ns/iter (± 0) 60 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed_clone 44 ns/iter (± 0) 44 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 106 ns/iter (± 0) 106 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed 81 ns/iter (± 0) 82 ns/iter (± 0) 0.99
es/visitor/base-perf/visit_contains_this 3271 ns/iter (± 63) 3498 ns/iter (± 82) 0.94
es/base/parallel/resolver/typescript 7508091120 ns/iter (± 452858155) 7106635553 ns/iter (± 480774995) 1.06
es/base/parallel/hygiene/typescript 2406401579 ns/iter (± 33241578) 2360723451 ns/iter (± 17994504) 1.02
misc/visitors/time-complexity/time 5 105 ns/iter (± 0) 104 ns/iter (± 0) 1.01
misc/visitors/time-complexity/time 10 355 ns/iter (± 8) 314 ns/iter (± 2) 1.13
misc/visitors/time-complexity/time 15 678 ns/iter (± 10) 623 ns/iter (± 12) 1.09
misc/visitors/time-complexity/time 20 1281 ns/iter (± 24) 1157 ns/iter (± 1) 1.11
misc/visitors/time-complexity/time 40 6813 ns/iter (± 24) 6088 ns/iter (± 30) 1.12
misc/visitors/time-complexity/time 60 17564 ns/iter (± 103) 15231 ns/iter (± 27) 1.15
es/full-target/es2016 270553 ns/iter (± 343) 270939 ns/iter (± 583) 1.00
es/full-target/es2017 260825 ns/iter (± 391) 259736 ns/iter (± 344) 1.00
es/full-target/es2018 250015 ns/iter (± 455) 248875 ns/iter (± 467) 1.00
es2020_nullish_coalescing 98690 ns/iter (± 372) 99108 ns/iter (± 504) 1.00
es2020_optional_chaining 121631 ns/iter (± 484) 122566 ns/iter (± 311) 0.99
es2022_class_properties 157410 ns/iter (± 232) 156717 ns/iter (± 343) 1.00
es2018_object_rest_spread 100851 ns/iter (± 197) 100989 ns/iter (± 321) 1.00
es2019_optional_catch_binding 88948 ns/iter (± 286) 89423 ns/iter (± 238) 0.99
es2017_async_to_generator 89469 ns/iter (± 156) 90121 ns/iter (± 324) 0.99
es2016_exponentiation 96324 ns/iter (± 376) 96543 ns/iter (± 330) 1.00
es2015_arrow 99610 ns/iter (± 343) 99330 ns/iter (± 302) 1.00
es2015_block_scoped_fn 97321 ns/iter (± 375) 97476 ns/iter (± 291) 1.00
es2015_block_scoping 184897 ns/iter (± 244) 184846 ns/iter (± 334) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.