Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: Source/bindings/scripts/v8_interface.py

Issue 792903004: IDL: Support extended attributes on iterable<>, maplike<> and setlike<> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 use_extended_attributes = {}
haraken 2015/01/14 11:38:47 used_extended_attributes ?
Jens Widell 2015/01/14 11:50:45 Works too. :-)
Jens Widell 2015/01/14 12:00:02 Done.
346
347 if interface.iterable:
348 use_extended_attributes.update(interface.iterable.extended_attribute s)
349 elif interface.maplike:
haraken 2015/01/14 11:38:47 elif => if ?
Jens Widell 2015/01/14 11:50:45 Wouldn't change behavior, since there can only be
haraken 2015/01/14 12:53:33 Makes sense.
350 use_extended_attributes.update(interface.maplike.extended_attributes )
351 elif interface.setlike:
haraken 2015/01/14 11:38:47 elif => if ?
352 use_extended_attributes.update(interface.setlike.extended_attributes )
353
354 if 'RaisesException' not in use_extended_attributes:
355 use_extended_attributes['RaisesException'] = None
356 if 'CallWith' not in use_extended_attributes:
357 use_extended_attributes['CallWith'] = 'ScriptState'
haraken 2015/01/14 11:38:47 This rule looks a bit hacky. Do we need to support
Jens Widell 2015/01/14 11:50:45 We don't need it right now, for sure, since there'
358
345 def generated_iterator_method(name): 359 def generated_iterator_method(name):
346 return generated_method( 360 return generated_method(
347 return_type=IdlType('Iterator'), 361 return_type=IdlType('Iterator'),
348 name=name, 362 name=name,
349 extended_attributes={'RaisesException': None, 'CallWith': 'Scrip tState'}) 363 extended_attributes=use_extended_attributes)
350 364
351 iterator_method = generated_iterator_method('iterator') 365 iterator_method = generated_iterator_method('iterator')
352 366
353 if interface.iterable: 367 if interface.iterable:
354 methods.extend([ 368 methods.extend([
355 generated_iterator_method('keys'), 369 generated_iterator_method('keys'),
356 generated_iterator_method('values'), 370 generated_iterator_method('values'),
357 generated_iterator_method('entries'), 371 generated_iterator_method('entries'),
358 ]) 372 ])
359 373
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 deleter = next( 1301 deleter = next(
1288 method 1302 method
1289 for method in interface.operations 1303 for method in interface.operations
1290 if ('deleter' in method.specials and 1304 if ('deleter' in method.specials and
1291 len(method.arguments) == 1 and 1305 len(method.arguments) == 1 and
1292 str(method.arguments[0].idl_type) == 'DOMString')) 1306 str(method.arguments[0].idl_type) == 'DOMString'))
1293 except StopIteration: 1307 except StopIteration:
1294 return None 1308 return None
1295 1309
1296 return property_deleter(deleter) 1310 return property_deleter(deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698