| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 | 6 |
| 7 from code import Code | 7 from code import Code |
| 8 from model import PropertyType | 8 from model import PropertyType |
| 9 import cpp_util | 9 import cpp_util |
| 10 import schema_util | 10 import schema_util |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 self._namespace.environment.namespace_pattern, | 67 self._namespace.environment.namespace_pattern, |
| 68 self._namespace.unix_name) | 68 self._namespace.unix_name) |
| 69 c.Concat(cpp_util.OpenNamespace(cpp_namespace)) | 69 c.Concat(cpp_util.OpenNamespace(cpp_namespace)) |
| 70 c.Append() | 70 c.Append() |
| 71 if self._namespace.properties: | 71 if self._namespace.properties: |
| 72 (c.Append('//') | 72 (c.Append('//') |
| 73 .Append('// Properties') | 73 .Append('// Properties') |
| 74 .Append('//') | 74 .Append('//') |
| 75 .Append() | 75 .Append() |
| 76 ) | 76 ) |
| 77 for property in self._namespace.properties.values(): | 77 for prop in self._namespace.properties.values(): |
| 78 property_code = self._type_helper.GeneratePropertyValues( | 78 property_code = self._type_helper.GeneratePropertyValues( |
| 79 property, | 79 prop, |
| 80 'extern const %(type)s %(name)s;') | 80 'extern const %(type)s %(name)s;') |
| 81 if property_code: | 81 if property_code: |
| 82 c.Cblock(property_code) | 82 c.Cblock(property_code) |
| 83 if self._namespace.types: | 83 if self._namespace.types: |
| 84 (c.Append('//') | 84 (c.Append('//') |
| 85 .Append('// Types') | 85 .Append('// Types') |
| 86 .Append('//') | 86 .Append('//') |
| 87 .Append() | 87 .Append() |
| 88 .Cblock(self._GenerateTypes(self._FieldDependencyOrder(), | 88 .Cblock(self._GenerateTypes(self._FieldDependencyOrder(), |
| 89 is_toplevel=True, | 89 is_toplevel=True, |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 """Builds the parameter list for a function, given an array of parameters. | 388 """Builds the parameter list for a function, given an array of parameters. |
| 389 """ | 389 """ |
| 390 # |error| is populated with warnings and/or errors found during parsing. | 390 # |error| is populated with warnings and/or errors found during parsing. |
| 391 # |error| being set does not necessarily imply failure and may be | 391 # |error| being set does not necessarily imply failure and may be |
| 392 # recoverable. | 392 # recoverable. |
| 393 # For example, optional properties may have failed to parse, but the | 393 # For example, optional properties may have failed to parse, but the |
| 394 # parser was able to continue. | 394 # parser was able to continue. |
| 395 if self._generate_error_messages: | 395 if self._generate_error_messages: |
| 396 params += ('base::string16* error',) | 396 params += ('base::string16* error',) |
| 397 return ', '.join(str(p) for p in params) | 397 return ', '.join(str(p) for p in params) |
| OLD | NEW |