Daniel ChengHi Daniel -- sorry for the large change. Turns out there was a lot of dead code. If this looks ok to you, I will bring in the other owners. Thanks!
General approach seems good. I'm comfortable using OO+1 here as well. Let me know what you prefer.
if language == '_metadata':What is `_metadata` used for? Is there somewhere we could add a comment? Perhaps in the docstring for `LoadTypemaps()`?
):... heh this is really awkward. Could use `lang` instead of `language` I guess...
f"Unused typemaps found for {lang}:\n{sorted(typemaps)},\n\n" \Nit: no \ needed here; we can rely on implicit line joining between parens
def Check(kind, enclosing_kind=None):I think a brief comment here would be helpful
mojom = "network::mojom::ReportingApiReportStatus"o.O
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Daniel ChengHi Daniel -- sorry for the large change. Turns out there was a lot of dead code. If this looks ok to you, I will bring in the other owners. Thanks!
General approach seems good. I'm comfortable using OO+1 here as well. Let me know what you prefer.
Let's go with OO+1 here. thanks.
What is `_metadata` used for? Is there somewhere we could add a comment? Perhaps in the docstring for `LoadTypemaps()`?
Done
... heh this is really awkward. Could use `lang` instead of `language` I guess...
done
f"Unused typemaps found for {lang}:\n{sorted(typemaps)},\n\n" \Nit: no \ needed here; we can rely on implicit line joining between parens
Done
I think a brief comment here would be helpful
Done
mojom = "network::mojom::ReportingApiReportStatus"Fred Shiho.O
My guess is that this has never worked..
::bluetooth::mojom::blink::UUID::New(Fred Shihoh.
Yea, this one is particularly strange. I think because the typemap was declared on another build rule, the actual type in the generated struct can be different depending on your dep path...
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Owners-Override | +1 |
"""Remove all the types that were encountered in code generation from theGiven the docstring... I guess I would have expected this to be named something more like "RemoveUsedTypemaps" or "ConsumeUsedTypemaps"
def Check(kind, enclosing_kind=None):And something like "RemoveUsedKind" or "ConsumeUsedKind" here.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
"""Remove all the types that were encountered in code generation from theGiven the docstring... I guess I would have expected this to be named something more like "RemoveUsedTypemaps" or "ConsumeUsedTypemaps"
Done
And something like "RemoveUsedKind" or "ConsumeUsedKind" here.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
26 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: mojo/public/tools/bindings/mojom_bindings_generator.py
Insertions: 7, Deletions: 7.
@@ -263,19 +263,19 @@
filtered_args = [arg for arg in remaining_args
if arg.startswith(prefix)]
generator.GenerateFiles(filtered_args)
- self._CheckTypemapsUsed(language, module)
+ self._RemoveUsedTypemaps(language, module)
# Save result.
self._processed_files[rel_filename.path] = module
return module
- def _CheckTypemapsUsed(self, language, module):
+ def _RemoveUsedTypemaps(self, language, module):
"""Remove all the types that were encountered in code generation from the
declared typemap list.
"""
# Fully qualify the kind and remove it from the declared typemaps.
- def Check(kind, enclosing_kind=None):
+ def RemoveUsedKind(kind, enclosing_kind=None):
namespace = module.mojom_namespace
if enclosing_kind:
namespace += f".{enclosing_kind.name}"
@@ -285,16 +285,16 @@
self._typemap_usage_verification[language].remove(name)
for kind in module.unions + module.enums:
- Check(kind)
+ RemoveUsedKind(kind)
for struct_kind in module.structs:
- Check(struct_kind)
+ RemoveUsedKind(struct_kind)
for enum in struct_kind.enums:
- Check(enum, struct_kind)
+ RemoveUsedKind(enum, struct_kind)
for iface_kind in module.interfaces:
for enum in iface_kind.enums:
- Check(enum, iface_kind)
+ RemoveUsedKind(enum, iface_kind)
def _Generate(args, remaining_args):
if args.variant == "none":
```
Add a verification step for typemap config
If there is a typo in the typemap config, this will raise a warning
telling the developer that a typemap has not been referenced.
Most of the change is mechanical (i.e.: removing dead typemaps that have
no effect).
This change will force typemaps to be declared in the mojom rule that
contains the mojom module where the type is declared, which is probably
better because having another target declare the typemaps can lead to
some very... interesting.. side effects. One of these side effects is
that the type of the generated code will look different, depending on
your deps.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
https://issuetracker.google.com/430747719 missing deps for obj/third_party/blink/public/mojom/mojom_platform_blink/array_buffer_contents.mojom-blink.o
?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |