Chromium Code Reviews| Index: tools/json_schema_compiler/feature_compiler.py |
| diff --git a/tools/json_schema_compiler/feature_compiler.py b/tools/json_schema_compiler/feature_compiler.py |
| index d28880220ec5ccfe3adc560cc9174b4b49afb717..9b04a7965a5abc310b334cd6d00b861396fbf913 100644 |
| --- a/tools/json_schema_compiler/feature_compiler.py |
| +++ b/tools/json_schema_compiler/feature_compiler.py |
| @@ -460,8 +460,17 @@ class FeatureCompiler(object): |
| sep = feature_name.rfind('.') |
| if sep is -1 or no_parent: |
| return None |
| + |
| parent_name = feature_name[:sep] |
| - if parent_name not in self._features: |
| + while sep != -1 and parent_name not in self._features: |
| + # This recursion allows for a feature to have a parent that isn't a direct |
| + # ancestor. For instance, we could have feature 'alpha', and feature |
| + # 'alpha.child.child', where 'alpha.child.child' inherits from 'alpha'. |
| + # TODO(devlin): Is this useful? Or logical? |
| + sep = feature_name.rfind('.', 0, sep) |
| + parent_name = feature_name[:sep] |
|
Devlin
2016/08/03 15:13:36
This is to account for parent2.child3.child.child
|
| + |
| + if sep == -1: |
| # TODO(devlin): It'd be kind of nice to be able to assert that the |
| # deduced parent name is in our features, but some dotted features don't |
| # have parents and also don't have noparent, e.g. system.cpu. We should |