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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 # 1. Let n be the number of arguments X is declared to take. | 629 # 1. Let n be the number of arguments X is declared to take. |
630 n = len(arguments) | 630 n = len(arguments) |
631 # 2. Let t0..n−1 be a list of types, where ti is the type of X’s | 631 # 2. Let t0..n−1 be a list of types, where ti is the type of X’s |
632 # argument at index i. | 632 # argument at index i. |
633 # (“type list”) | 633 # (“type list”) |
634 t = tuple(argument['idl_type_object'] for argument in arguments) | 634 t = tuple(argument['idl_type_object'] for argument in arguments) |
635 # 3. Let o0..n−1 be a list of optionality values, where oi is “variadic” | 635 # 3. Let o0..n−1 be a list of optionality values, where oi is “variadic” |
636 # if X’s argument at index i is a final, variadic argument, “optional” | 636 # if X’s argument at index i is a final, variadic argument, “optional” |
637 # if the argument is optional, and “required” otherwise. | 637 # if the argument is optional, and “required” otherwise. |
638 # (“optionality list”) | 638 # (“optionality list”) |
639 # (We’re just using a boolean for optional vs. required.) | 639 # (We’re just using a boolean for optional/variadic vs. required.) |
640 o = tuple(argument['is_optional'] for argument in arguments) | 640 o = tuple(argument['is_optional'] or argument['is_variadic'] |
| 641 for argument in arguments) |
641 # 4. Add to S the tuple <X, t0..n−1, o0..n−1>. | 642 # 4. Add to S the tuple <X, t0..n−1, o0..n−1>. |
642 S.append((X, t, o)) | 643 S.append((X, t, o)) |
643 # 5. If X is declared to be variadic, then: | 644 # 5. If X is declared to be variadic, then: |
644 # (Not used, so not implemented.) | 645 # (Not used, so not implemented.) |
645 # 6. Initialize i to n−1. | 646 # 6. Initialize i to n−1. |
646 i = n - 1 | 647 i = n - 1 |
647 # 7. While i ≥ 0: | 648 # 7. While i ≥ 0: |
648 # Spec bug (fencepost error); should be “While i > 0:” | 649 # Spec bug (fencepost error); should be “While i > 0:” |
649 # https://www.w3.org/Bugs/Public/show_bug.cgi?id=25590 | 650 # https://www.w3.org/Bugs/Public/show_bug.cgi?id=25590 |
650 while i > 0: | 651 while i > 0: |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 deleter = next( | 1240 deleter = next( |
1240 method | 1241 method |
1241 for method in interface.operations | 1242 for method in interface.operations |
1242 if ('deleter' in method.specials and | 1243 if ('deleter' in method.specials and |
1243 len(method.arguments) == 1 and | 1244 len(method.arguments) == 1 and |
1244 str(method.arguments[0].idl_type) == 'DOMString')) | 1245 str(method.arguments[0].idl_type) == 'DOMString')) |
1245 except StopIteration: | 1246 except StopIteration: |
1246 return None | 1247 return None |
1247 | 1248 |
1248 return property_deleter(deleter) | 1249 return property_deleter(deleter) |
OLD | NEW |