OLD | NEW |
---|---|
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # coding=utf-8 | 2 # coding=utf-8 |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 | 460 |
461 for implicit_method in implicit_methods: | 461 for implicit_method in implicit_methods: |
462 if implicit_method['name'] in methods_by_name: | 462 if implicit_method['name'] in methods_by_name: |
463 # FIXME: Check that the existing method is compatible. | 463 # FIXME: Check that the existing method is compatible. |
464 continue | 464 continue |
465 methods.append(implicit_method) | 465 methods.append(implicit_method) |
466 | 466 |
467 # FIXME: maplike<> and setlike<> should also imply the presence of a | 467 # FIXME: maplike<> and setlike<> should also imply the presence of a |
468 # 'size' attribute. | 468 # 'size' attribute. |
469 | 469 |
470 # Serializer | |
471 if interface.serializer: | |
472 serializer = interface.serializer | |
473 serializer_ext_attrs = serializer.extended_attributes.copy() | |
474 if serializer.operation: | |
475 return_type = serializer.operation.idl_type | |
476 implemented_as = serializer.operation.name | |
477 else: | |
478 return_type = IdlType('any') | |
479 implemented_as = None | |
480 if 'CallWith' not in serializer_ext_attrs: | |
haraken
2015/03/26 01:39:20
What if the serializer has [CallWith] but the [Cal
Jens Widell
2015/03/26 05:34:10
We could call that a bug in the IDL; it needs a Sc
haraken
2015/03/26 05:36:02
Makes sense.
| |
481 serializer_ext_attrs['CallWith'] = 'ScriptState' | |
482 methods.append(generated_method( | |
483 return_type=return_type, | |
484 name='toJSON', | |
485 extended_attributes=serializer_ext_attrs, | |
486 implemented_as=implemented_as)) | |
487 | |
470 # Stringifier | 488 # Stringifier |
471 if interface.stringifier: | 489 if interface.stringifier: |
472 stringifier = interface.stringifier | 490 stringifier = interface.stringifier |
473 stringifier_ext_attrs = stringifier.extended_attributes.copy() | 491 stringifier_ext_attrs = stringifier.extended_attributes.copy() |
474 if stringifier.attribute: | 492 if stringifier.attribute: |
475 stringifier_ext_attrs['ImplementedAs'] = stringifier.attribute.name | 493 implemented_as = stringifier.attribute.name |
476 elif stringifier.operation: | 494 elif stringifier.operation: |
477 stringifier_ext_attrs['ImplementedAs'] = stringifier.operation.name | 495 implemented_as = stringifier.operation.name |
496 else: | |
497 implemented_as = 'toString' | |
478 methods.append(generated_method( | 498 methods.append(generated_method( |
479 return_type=IdlType('DOMString'), | 499 return_type=IdlType('DOMString'), |
480 name='toString', | 500 name='toString', |
481 extended_attributes=stringifier_ext_attrs, | 501 extended_attributes=stringifier_ext_attrs, |
482 implemented_as='toString')) | 502 implemented_as=implemented_as)) |
483 | 503 |
484 conditionally_enabled_methods = [] | 504 conditionally_enabled_methods = [] |
485 custom_registration_methods = [] | 505 custom_registration_methods = [] |
486 method_configuration_methods = [] | 506 method_configuration_methods = [] |
487 | 507 |
488 for method in methods: | 508 for method in methods: |
489 # Skip all but one method in each set of overloaded methods. | 509 # Skip all but one method in each set of overloaded methods. |
490 if 'overload_index' in method and 'overloads' not in method: | 510 if 'overload_index' in method and 'overloads' not in method: |
491 continue | 511 continue |
492 | 512 |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1308 | 1328 |
1309 idl_type = deleter.idl_type | 1329 idl_type = deleter.idl_type |
1310 extended_attributes = deleter.extended_attributes | 1330 extended_attributes = deleter.extended_attributes |
1311 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') | 1331 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') |
1312 return { | 1332 return { |
1313 'is_call_with_script_state': is_call_with_script_state, | 1333 'is_call_with_script_state': is_call_with_script_state, |
1314 'is_custom': 'Custom' in extended_attributes, | 1334 'is_custom': 'Custom' in extended_attributes, |
1315 'is_raises_exception': 'RaisesException' in extended_attributes, | 1335 'is_raises_exception': 'RaisesException' in extended_attributes, |
1316 'name': cpp_name(deleter), | 1336 'name': cpp_name(deleter), |
1317 } | 1337 } |
OLD | NEW |