| Index: mojo/public/bindings/pylib/generate/mojom_generator.py
|
| diff --git a/mojo/public/bindings/pylib/generate/mojom_generator.py b/mojo/public/bindings/pylib/generate/mojom_generator.py
|
| index 7e89c03e571c56914f4ad5406c0c2e17a08052bf..e8c0fd5ad68241bc150b2ad8dac2567a7ba8d22d 100644
|
| --- a/mojo/public/bindings/pylib/generate/mojom_generator.py
|
| +++ b/mojo/public/bindings/pylib/generate/mojom_generator.py
|
| @@ -25,6 +25,12 @@ def GetStructInfo(exported, struct):
|
| struct.exported = exported
|
| return struct
|
|
|
| +def GetStructByName(structs, name):
|
| + for struct in structs:
|
| + if struct.name == name:
|
| + return struct
|
| + return None
|
| +
|
| def IsStringKind(kind):
|
| return kind.spec == 's'
|
|
|
| @@ -41,6 +47,18 @@ def CamelToUnderscores(camel):
|
| def StudlyCapsToCamel(studly):
|
| return studly[0].lower() + studly[1:]
|
|
|
| +def VerifyTokenType(token, expected):
|
| + """Used to check that arrays and objects are used correctly as default
|
| + values. Arrays are tokens that look like ('ARRAY', element0, element1...).
|
| + See mojom_parser.py for their representation.
|
| + """
|
| + if not isinstance(token, tuple):
|
| + raise Exception("Expected token type '%s'. Invalid token '%s'." %
|
| + (expected, token))
|
| + if token[0] != expected:
|
| + raise Exception("Expected token type '%s'. Got '%s'." %
|
| + (expected, token[0]))
|
| +
|
| class Generator(object):
|
| # Pass |output_dir| to emit files to disk. Omit |output_dir| to echo all
|
| # files to stdout.
|
|
|