Commit b70fb2c
authored
[rosidl_gen] Refactor the dot used to generate the JavaScript messages (#1014)
`rclnodejs` leverages [`dot`](https://www.npmjs.com/package/dot) to generate the JavaScript classes, representing the ROS messages and wrapping the [`ref`](https://www.npmjs.com/package/@rclnodejs/ref-napi) objects that can read/write from C++ pointer. For a long time, we changed the implementation along with new features introduced into ROS2, so it makes the template itself messy and hard to understand.
This patch tries to refactor the template to make it more readable and maintainable, including:
1. Add proper indents for `for`/`if` used by the template to make it easy to understand.
2. Abstract some functionalities into separate functions, like `_setDefaults()`.
3. Add more meaningful comments by ```{{/* */}}```.
4. Remove the consistency checking.
Besides, the following changes are made accordingly:
1. Remove the `willCheckConsistency` usage from current JS files.
2. Remove tests related to consistency checking in `test-compound-msg-type-check.js` and `test-security-related.js`.
3. Use `prettier` to format the generated JavaScript files.
4. Pump the generator version to `0.4.0`.
Fix: #10151 parent 3b14b87 commit b70fb2c
File tree
9 files changed
+211
-343
lines changed- lib
- rosidl_gen
- templates
- test
9 files changed
+211
-343
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | 505 | | |
510 | 506 | | |
511 | 507 | | |
| |||
592 | 588 | | |
593 | 589 | | |
594 | 590 | | |
595 | | - | |
596 | 591 | | |
597 | 592 | | |
598 | 593 | | |
| |||
695 | 690 | | |
696 | 691 | | |
697 | 692 | | |
698 | | - | |
699 | 693 | | |
700 | 694 | | |
701 | 695 | | |
| |||
1696 | 1690 | | |
1697 | 1691 | | |
1698 | 1692 | | |
1699 | | - | |
1700 | 1693 | | |
1701 | 1694 | | |
1702 | 1695 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| |||
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
86 | | - | |
| 85 | + | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
0 commit comments