Commit 131beb1
Add enum:self for direct AST access in templates
Summary:
Add `enum:self` for direct AST access in templates. To this end pass the prototype database via `mstch_context` to mstch object ctors.
Demonstrate usage by updating `declare_enums.mustache`.
Before:
```
return "{{enum:name}}";
```
After:
```
return "{{enum:self.name}}";
```
Once we fully migrate templates, we'll be able to drop the `self` part which will give the same ergonomics as before but without the legacy mstch object layer.
To simplify the review `self` is only added to a single mstch object type in this diff, the rest will be added in a follow-up diff.
Reviewed By: praihan
Differential Revision: D71205072
fbshipit-source-id: 6db90dc5442e34bf7382264abe6a5c90f0ec35451 parent e3d7de6 commit 131beb1
File tree
3 files changed
+9
-1
lines changed- third-party/thrift/src/thrift/compiler/generate
- templates/cpp2/module_types_h
3 files changed
+9
-1
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| |||
1196 | 1198 | | |
1197 | 1199 | | |
1198 | 1200 | | |
| 1201 | + | |
1199 | 1202 | | |
1200 | 1203 | | |
1201 | 1204 | | |
| |||
1210 | 1213 | | |
1211 | 1214 | | |
1212 | 1215 | | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1213 | 1220 | | |
1214 | 1221 | | |
1215 | 1222 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
0 commit comments