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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 | 1244 |
1245 if self._IsStatic(node.id): | 1245 if self._IsStatic(node.id): |
1246 needs_receiver = True | 1246 needs_receiver = True |
1247 | 1247 |
1248 cpp_arguments = [] | 1248 cpp_arguments = [] |
1249 runtime_check = None | 1249 runtime_check = None |
1250 raises_exceptions = raises_dom_exception or arguments or needs_receiver | 1250 raises_exceptions = raises_dom_exception or arguments or needs_receiver |
1251 needs_custom_element_callbacks = False | 1251 needs_custom_element_callbacks = False |
1252 | 1252 |
1253 # TODO(antonm): unify with ScriptState below. | 1253 # TODO(antonm): unify with ScriptState below. |
1254 call_with = ext_attrs.get('CallWith', '') + ext_attrs.get('ConstructorCallWi
th', '') | 1254 call_with = ext_attrs.get('CallWith', []) |
| 1255 if not(isinstance(call_with, list)): |
| 1256 call_with = [call_with] |
| 1257 constructor_with = ext_attrs.get('ConstructorCallWith', []) |
| 1258 if not(isinstance(constructor_with, list)): |
| 1259 constructor_with = [constructor_with] |
| 1260 call_with = call_with + constructor_with |
| 1261 |
| 1262 |
1255 requires_stack_info = 'ScriptArguments' in call_with or 'ScriptState' in cal
l_with | 1263 requires_stack_info = 'ScriptArguments' in call_with or 'ScriptState' in cal
l_with |
1256 if requires_stack_info: | 1264 if requires_stack_info: |
1257 raises_exceptions = True | 1265 raises_exceptions = True |
1258 cpp_arguments = ['&state', 'scriptArguments.release()'] | 1266 cpp_arguments = ['&state', 'scriptArguments.release()'] |
1259 # WebKit uses scriptArguments to reconstruct last argument, so | 1267 # WebKit uses scriptArguments to reconstruct last argument, so |
1260 # it's not needed and should be just removed. | 1268 # it's not needed and should be just removed. |
1261 arguments = arguments[:-1] | 1269 arguments = arguments[:-1] |
1262 | 1270 |
1263 # TODO(antonm): unify with ScriptState below. | 1271 # TODO(antonm): unify with ScriptState below. |
1264 requires_script_arguments = (ext_attrs.get('CallWith') == 'ScriptArguments'
or | 1272 requires_script_arguments = (ext_attrs.get('CallWith') == 'ScriptArguments'
or |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 | 1915 |
1908 def _IsCustom(op_or_attr): | 1916 def _IsCustom(op_or_attr): |
1909 assert(isinstance(op_or_attr, IDLMember)) | 1917 assert(isinstance(op_or_attr, IDLMember)) |
1910 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 1918 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
1911 | 1919 |
1912 def _IsCustomValue(op_or_attr, value): | 1920 def _IsCustomValue(op_or_attr, value): |
1913 if _IsCustom(op_or_attr): | 1921 if _IsCustom(op_or_attr): |
1914 return op_or_attr.ext_attrs.get('Custom') == value \ | 1922 return op_or_attr.ext_attrs.get('Custom') == value \ |
1915 or op_or_attr.ext_attrs.get('DartCustom') == value | 1923 or op_or_attr.ext_attrs.get('DartCustom') == value |
1916 return False | 1924 return False |
OLD | NEW |