Chromium Code Reviews| 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 provides shared functionality for the systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 829 arguments.insert(0, 'receiver') | 829 arguments.insert(0, 'receiver') |
| 830 self._cpp_impl_includes.add('"%s.h"' % attributes['ImplementedBy']) | 830 self._cpp_impl_includes.add('"%s.h"' % attributes['ImplementedBy']) |
| 831 | 831 |
| 832 return emitter.Format(invocation_template, | 832 return emitter.Format(invocation_template, |
| 833 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) | 833 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) |
| 834 | 834 |
| 835 def _GenerateCPPIncludes(includes): | 835 def _GenerateCPPIncludes(includes): |
| 836 return ''.join(['#include %s\n' % include for include in includes]) | 836 return ''.join(['#include %s\n' % include for include in includes]) |
| 837 | 837 |
| 838 def _DOMWrapperType(database, interface): | 838 def _DOMWrapperType(database, interface): |
| 839 if interface.id == 'MessagePort': | |
| 840 return 'MessagePort' | |
| 841 | |
| 842 type = 'Object' | |
|
Anton Muhin
2012/04/17 17:42:06
why it's not DOM{Object,Node} any more?
podivilov
2012/04/18 08:46:53
For brevity. These type names are declared in Dart
Anton Muhin
2012/04/18 09:01:06
ok, thanks
On 2012/04/18 08:46:53, podivilov wrot
| |
| 839 if _InstanceOfNode(database, interface): | 843 if _InstanceOfNode(database, interface): |
| 840 return 'DOMNode' | 844 type = 'Node' |
| 841 return 'DOMObject' | 845 if 'ActiveDOMObject' in interface.ext_attrs: |
| 846 type = 'Active%s' % type | |
| 847 return type | |
| 842 | 848 |
| 843 def _InstanceOfNode(database, interface): | 849 def _InstanceOfNode(database, interface): |
| 844 if interface.id == 'Node': | 850 if interface.id == 'Node': |
| 845 return True | 851 return True |
| 846 for parent in interface.parents: | 852 for parent in interface.parents: |
| 847 if not database.HasInterface(parent.type.id): | 853 if not database.HasInterface(parent.type.id): |
| 848 continue | 854 continue |
| 849 parent_interface = database.GetInterface(parent.type.id) | 855 parent_interface = database.GetInterface(parent.type.id) |
| 850 if _InstanceOfNode(database, parent_interface): | 856 if _InstanceOfNode(database, parent_interface): |
| 851 return True | 857 return True |
| 852 return False | 858 return False |
| OLD | NEW |