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('V8ObjectBuilder') |
| 479 implemented_as = None |
| 480 methods.append(generated_method( |
| 481 return_type=return_type, |
| 482 name='toJSON', |
| 483 extended_attributes=serializer_ext_attrs, |
| 484 implemented_as=implemented_as)) |
| 485 |
470 # Stringifier | 486 # Stringifier |
471 if interface.stringifier: | 487 if interface.stringifier: |
472 stringifier = interface.stringifier | 488 stringifier = interface.stringifier |
473 stringifier_ext_attrs = stringifier.extended_attributes.copy() | 489 stringifier_ext_attrs = stringifier.extended_attributes.copy() |
474 if stringifier.attribute: | 490 if stringifier.attribute: |
475 stringifier_ext_attrs['ImplementedAs'] = stringifier.attribute.name | 491 implemented_as = stringifier.attribute.name |
476 elif stringifier.operation: | 492 elif stringifier.operation: |
477 stringifier_ext_attrs['ImplementedAs'] = stringifier.operation.name | 493 implemented_as = stringifier.operation.name |
| 494 else: |
| 495 implemented_as = 'toString' |
478 methods.append(generated_method( | 496 methods.append(generated_method( |
479 return_type=IdlType('DOMString'), | 497 return_type=IdlType('DOMString'), |
480 name='toString', | 498 name='toString', |
481 extended_attributes=stringifier_ext_attrs, | 499 extended_attributes=stringifier_ext_attrs, |
482 implemented_as='toString')) | 500 implemented_as=implemented_as)) |
483 | 501 |
484 conditionally_enabled_methods = [] | 502 conditionally_enabled_methods = [] |
485 custom_registration_methods = [] | 503 custom_registration_methods = [] |
486 method_configuration_methods = [] | 504 method_configuration_methods = [] |
487 | 505 |
488 for method in methods: | 506 for method in methods: |
489 # Skip all but one method in each set of overloaded methods. | 507 # Skip all but one method in each set of overloaded methods. |
490 if 'overload_index' in method and 'overloads' not in method: | 508 if 'overload_index' in method and 'overloads' not in method: |
491 continue | 509 continue |
492 | 510 |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 | 1326 |
1309 idl_type = deleter.idl_type | 1327 idl_type = deleter.idl_type |
1310 extended_attributes = deleter.extended_attributes | 1328 extended_attributes = deleter.extended_attributes |
1311 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1329 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
1312 return { | 1330 return { |
1313 'is_call_with_script_state': is_call_with_script_state, | 1331 'is_call_with_script_state': is_call_with_script_state, |
1314 'is_custom': 'Custom' in extended_attributes, | 1332 'is_custom': 'Custom' in extended_attributes, |
1315 'is_raises_exception': 'RaisesException' in extended_attributes, | 1333 'is_raises_exception': 'RaisesException' in extended_attributes, |
1316 'name': cpp_name(deleter), | 1334 'name': cpp_name(deleter), |
1317 } | 1335 } |
OLD | NEW |