| 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.path | 5 import os.path |
| 6 | 6 |
| 7 from json_parse import OrderedDict | 7 from json_parse import OrderedDict |
| 8 from memoize import memoize | 8 from memoize import memoize |
| 9 | 9 |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 self.ref_type = json['$ref'] | 203 self.ref_type = json['$ref'] |
| 204 elif 'enum' in json and json_type == 'string': | 204 elif 'enum' in json and json_type == 'string': |
| 205 if not namespace.allow_inline_enums and not isinstance(parent, Namespace): | 205 if not namespace.allow_inline_enums and not isinstance(parent, Namespace): |
| 206 raise ParseException( | 206 raise ParseException( |
| 207 self, | 207 self, |
| 208 'Inline enum "%s" found in namespace "%s". These are not allowed. ' | 208 'Inline enum "%s" found in namespace "%s". These are not allowed. ' |
| 209 'See crbug.com/472279' % (name, namespace.name)) | 209 'See crbug.com/472279' % (name, namespace.name)) |
| 210 self.property_type = PropertyType.ENUM | 210 self.property_type = PropertyType.ENUM |
| 211 self.enum_values = [EnumValue(value) for value in json['enum']] | 211 self.enum_values = [EnumValue(value) for value in json['enum']] |
| 212 self.cpp_enum_prefix_override = json.get('cpp_enum_prefix_override', None) | 212 self.cpp_enum_prefix_override = json.get('cpp_enum_prefix_override', None) |
| 213 self.is_class = json.get('class', False) |
| 213 elif json_type == 'any': | 214 elif json_type == 'any': |
| 214 self.property_type = PropertyType.ANY | 215 self.property_type = PropertyType.ANY |
| 215 elif json_type == 'binary': | 216 elif json_type == 'binary': |
| 216 self.property_type = PropertyType.BINARY | 217 self.property_type = PropertyType.BINARY |
| 217 elif json_type == 'boolean': | 218 elif json_type == 'boolean': |
| 218 self.property_type = PropertyType.BOOLEAN | 219 self.property_type = PropertyType.BOOLEAN |
| 219 elif json_type == 'integer': | 220 elif json_type == 'integer': |
| 220 self.property_type = PropertyType.INTEGER | 221 self.property_type = PropertyType.INTEGER |
| 221 elif (json_type == 'double' or | 222 elif (json_type == 'double' or |
| 222 json_type == 'number'): | 223 json_type == 'number'): |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 # Sanity check: platforms should not be an empty list. | 609 # Sanity check: platforms should not be an empty list. |
| 609 if not json['platforms']: | 610 if not json['platforms']: |
| 610 raise ValueError('"platforms" cannot be an empty list') | 611 raise ValueError('"platforms" cannot be an empty list') |
| 611 platforms = [] | 612 platforms = [] |
| 612 for platform_name in json['platforms']: | 613 for platform_name in json['platforms']: |
| 613 for platform_enum in _Enum.GetAll(Platforms): | 614 for platform_enum in _Enum.GetAll(Platforms): |
| 614 if platform_name == platform_enum.name: | 615 if platform_name == platform_enum.name: |
| 615 platforms.append(platform_enum) | 616 platforms.append(platform_enum) |
| 616 break | 617 break |
| 617 return platforms | 618 return platforms |
| OLD | NEW |