| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module generates Dart APIs from the IDL database.""" | 6 """This module generates Dart APIs from the IDL database.""" |
| 7 | 7 |
| 8 import emitter | 8 import emitter |
| 9 import idlnode | 9 import idlnode |
| 10 import logging | 10 import logging |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if database.HasEnum(stripped_type_name): | 50 if database.HasEnum(stripped_type_name): |
| 51 return True | 51 return True |
| 52 | 52 |
| 53 dart_template_match = self._dart_templates_re.match(type_name) | 53 dart_template_match = self._dart_templates_re.match(type_name) |
| 54 if dart_template_match: | 54 if dart_template_match: |
| 55 # Dart templates | 55 # Dart templates |
| 56 parent_type_name = type_name[0 : dart_template_match.start(1) - 1] | 56 parent_type_name = type_name[0 : dart_template_match.start(1) - 1] |
| 57 sub_type_name = dart_template_match.group(1) | 57 sub_type_name = dart_template_match.group(1) |
| 58 return (self._IsCompoundType(database, parent_type_name) and | 58 return (self._IsCompoundType(database, parent_type_name) and |
| 59 self._IsCompoundType(database, sub_type_name)) | 59 self._IsCompoundType(database, sub_type_name)) |
| 60 |
| 61 if type_name == 'union': |
| 62 return True |
| 63 |
| 60 return False | 64 return False |
| 61 | 65 |
| 62 def _IsDartType(self, type_name): | 66 def _IsDartType(self, type_name): |
| 63 return '.' in type_name | 67 return '.' in type_name |
| 64 | 68 |
| 65 def LoadAuxiliary(self, auxiliary_dir): | 69 def LoadAuxiliary(self, auxiliary_dir): |
| 66 def Visitor(_, dirname, names): | 70 def Visitor(_, dirname, names): |
| 67 for name in names: | 71 for name in names: |
| 68 if name.endswith('.dart'): | 72 if name.endswith('.dart'): |
| 69 name = name[0:-5] # strip off ".dart" | 73 name = name[0:-5] # strip off ".dart" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 def AddMissingArguments(self, database): | 231 def AddMissingArguments(self, database): |
| 228 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg')
]) | 232 ARG = idlnode.IDLArgument([('Type', ('ScopedName', 'object')), ('Id', 'arg')
]) |
| 229 for interface in database.GetInterfaces(): | 233 for interface in database.GetInterfaces(): |
| 230 for operation in interface.operations: | 234 for operation in interface.operations: |
| 231 call_with = (operation.ext_attrs.get('CallWith', '').split('|') + | 235 call_with = (operation.ext_attrs.get('CallWith', '').split('|') + |
| 232 operation.ext_attrs.get('ConstructorCallWith', '').split('|
') + | 236 operation.ext_attrs.get('ConstructorCallWith', '').split('|
') + |
| 233 operation.ext_attrs.get('CallWith', '').split('&') + | 237 operation.ext_attrs.get('CallWith', '').split('&') + |
| 234 operation.ext_attrs.get('ConstructorCallWith', '').split('&
')) | 238 operation.ext_attrs.get('ConstructorCallWith', '').split('&
')) |
| 235 if 'ScriptArguments' in call_with: | 239 if 'ScriptArguments' in call_with: |
| 236 operation.arguments.append(ARG) | 240 operation.arguments.append(ARG) |
| OLD | NEW |