| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   335     # [Iterable], iterable<>, maplike<> and setlike<> |   335     # [Iterable], iterable<>, maplike<> and setlike<> | 
|   336     iterator_method = None |   336     iterator_method = None | 
|   337     # FIXME: support Iterable in partial interfaces. However, we don't |   337     # FIXME: support Iterable in partial interfaces. However, we don't | 
|   338     # need to support iterator overloads between interface and |   338     # need to support iterator overloads between interface and | 
|   339     # partial interface definitions. |   339     # partial interface definitions. | 
|   340     # http://heycam.github.io/webidl/#idl-overloading |   340     # http://heycam.github.io/webidl/#idl-overloading | 
|   341     if (not interface.is_partial |   341     if (not interface.is_partial | 
|   342         and (interface.iterable or interface.maplike or interface.setlike |   342         and (interface.iterable or interface.maplike or interface.setlike | 
|   343              or 'Iterable' in extended_attributes)): |   343              or 'Iterable' in extended_attributes)): | 
|   344  |   344  | 
 |   345         used_extended_attributes = {} | 
 |   346  | 
 |   347         if interface.iterable: | 
 |   348             used_extended_attributes.update(interface.iterable.extended_attribut
      es) | 
 |   349         elif interface.maplike: | 
 |   350             used_extended_attributes.update(interface.maplike.extended_attribute
      s) | 
 |   351         elif interface.setlike: | 
 |   352             used_extended_attributes.update(interface.setlike.extended_attribute
      s) | 
 |   353  | 
 |   354         if 'RaisesException' in used_extended_attributes: | 
 |   355             raise ValueError('[RaisesException] is implied for iterable<>/maplik
      e<>/setlike<>') | 
 |   356         if 'CallWith' in used_extended_attributes: | 
 |   357             raise ValueError('[CallWith=ScriptState] is implied for iterable<>/m
      aplike<>/setlike<>') | 
 |   358  | 
 |   359         used_extended_attributes.update({ | 
 |   360             'RaisesException': None, | 
 |   361             'CallWith': 'ScriptState', | 
 |   362         }) | 
 |   363  | 
|   345         def generated_iterator_method(name): |   364         def generated_iterator_method(name): | 
|   346             return generated_method( |   365             return generated_method( | 
|   347                 return_type=IdlType('Iterator'), |   366                 return_type=IdlType('Iterator'), | 
|   348                 name=name, |   367                 name=name, | 
|   349                 extended_attributes={'RaisesException': None, 'CallWith': 'Scrip
      tState'}) |   368                 extended_attributes=used_extended_attributes) | 
|   350  |   369  | 
|   351         iterator_method = generated_iterator_method('iterator') |   370         iterator_method = generated_iterator_method('iterator') | 
|   352  |   371  | 
|   353         if interface.iterable: |   372         if interface.iterable: | 
|   354             methods.extend([ |   373             methods.extend([ | 
|   355                 generated_iterator_method('keys'), |   374                 generated_iterator_method('keys'), | 
|   356                 generated_iterator_method('values'), |   375                 generated_iterator_method('values'), | 
|   357                 generated_iterator_method('entries'), |   376                 generated_iterator_method('entries'), | 
|   358             ]) |   377             ]) | 
|   359  |   378  | 
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1287         deleter = next( |  1306         deleter = next( | 
|  1288             method |  1307             method | 
|  1289             for method in interface.operations |  1308             for method in interface.operations | 
|  1290             if ('deleter' in method.specials and |  1309             if ('deleter' in method.specials and | 
|  1291                 len(method.arguments) == 1 and |  1310                 len(method.arguments) == 1 and | 
|  1292                 str(method.arguments[0].idl_type) == 'DOMString')) |  1311                 str(method.arguments[0].idl_type) == 'DOMString')) | 
|  1293     except StopIteration: |  1312     except StopIteration: | 
|  1294         return None |  1313         return None | 
|  1295  |  1314  | 
|  1296     return property_deleter(deleter) |  1315     return property_deleter(deleter) | 
| OLD | NEW |