OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 base_idl_type in ['EventTarget', 'Window'] or | 378 base_idl_type in ['EventTarget', 'Window'] or |
379 base_idl_type.startswith(('HTML', 'SVG'))))) | 379 base_idl_type.startswith(('HTML', 'SVG'))))) |
380 | 380 |
381 | 381 |
382 ################################################################################ | 382 ################################################################################ |
383 # Setter | 383 # Setter |
384 ################################################################################ | 384 ################################################################################ |
385 | 385 |
386 def setter_context(interface, attribute, interfaces, context): | 386 def setter_context(interface, attribute, interfaces, context): |
387 if 'PutForwards' in attribute.extended_attributes: | 387 if 'PutForwards' in attribute.extended_attributes: |
388 # Use target interface and attribute in place of original interface and | 388 # Make sure the target interface and attribute exist. |
389 # attribute from this point onwards. | |
390 target_interface_name = attribute.idl_type.base_type | 389 target_interface_name = attribute.idl_type.base_type |
391 target_attribute_name = attribute.extended_attributes['PutForwards'] | 390 target_attribute_name = attribute.extended_attributes['PutForwards'] |
392 interface = interfaces[target_interface_name] | 391 interface = interfaces[target_interface_name] |
393 try: | 392 try: |
394 attribute = next(candidate | 393 next(candidate |
395 for candidate in interface.attributes | 394 for candidate in interface.attributes |
396 if candidate.name == target_attribute_name) | 395 if candidate.name == target_attribute_name) |
397 except StopIteration: | 396 except StopIteration: |
398 raise Exception('[PutForward] target not found:\n' | 397 raise Exception('[PutForward] target not found:\n' |
399 'Attribute "%s" is not present in interface "%s"' % | 398 'Attribute "%s" is not present in interface "%s"' % |
400 (target_attribute_name, target_interface_name)) | 399 (target_attribute_name, target_interface_name)) |
| 400 context['target_attribute_name'] = target_attribute_name |
| 401 return |
401 | 402 |
402 if ('Replaceable' in attribute.extended_attributes): | 403 if ('Replaceable' in attribute.extended_attributes): |
403 context['cpp_setter'] = ( | 404 context['cpp_setter'] = ( |
404 'V8CallBoolean(info.Holder()->CreateDataProperty(' + | 405 'V8CallBoolean(info.Holder()->CreateDataProperty(' + |
405 'info.GetIsolate()->GetCurrentContext(), propertyName, v8Value))') | 406 'info.GetIsolate()->GetCurrentContext(), propertyName, v8Value))') |
406 return | 407 return |
407 | 408 |
408 extended_attributes = attribute.extended_attributes | 409 extended_attributes = attribute.extended_attributes |
409 idl_type = attribute.idl_type | 410 idl_type = attribute.idl_type |
410 | 411 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 def is_constructor_attribute(attribute): | 571 def is_constructor_attribute(attribute): |
571 return attribute.idl_type.name.endswith('Constructor') | 572 return attribute.idl_type.name.endswith('Constructor') |
572 | 573 |
573 | 574 |
574 def is_named_constructor_attribute(attribute): | 575 def is_named_constructor_attribute(attribute): |
575 return attribute.idl_type.name.endswith('ConstructorConstructor') | 576 return attribute.idl_type.name.endswith('ConstructorConstructor') |
576 | 577 |
577 | 578 |
578 def update_constructor_attribute_context(interface, attribute, context): | 579 def update_constructor_attribute_context(interface, attribute, context): |
579 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 580 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |