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

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

Issue 894693005: IDL: Auto-declare implied methods only if not otherwise declared (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix spelling Created 5 years, 10 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
« no previous file with comments | « no previous file | Source/bindings/tests/idls/core/TestInterface3.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 def generated_iterator_method(name): 378 def generated_iterator_method(name):
379 return generated_method( 379 return generated_method(
380 return_type=IdlType('Iterator'), 380 return_type=IdlType('Iterator'),
381 name=name, 381 name=name,
382 extended_attributes=used_extended_attributes) 382 extended_attributes=used_extended_attributes)
383 383
384 iterator_method = generated_iterator_method('iterator') 384 iterator_method = generated_iterator_method('iterator')
385 385
386 if interface.iterable or interface.maplike or interface.setlike: 386 if interface.iterable or interface.maplike or interface.setlike:
387 methods.extend([ 387 implicit_methods = [
388 generated_iterator_method('keys'), 388 generated_iterator_method('keys'),
389 generated_iterator_method('values'), 389 generated_iterator_method('values'),
390 generated_iterator_method('entries'), 390 generated_iterator_method('entries'),
391 391
392 # void forEach(Function callback, [Default=Undefined] optional a ny thisArg) 392 # void forEach(Function callback, [Default=Undefined] optional a ny thisArg)
393 generated_method(IdlType('void'), 'forEach', 393 generated_method(IdlType('void'), 'forEach',
394 arguments=[generated_argument(IdlType('Function '), 'callback'), 394 arguments=[generated_argument(IdlType('Function '), 'callback'),
395 generated_argument(IdlType('any'), ' thisArg', 395 generated_argument(IdlType('any'), ' thisArg',
396 is_optional=True, 396 is_optional=True,
397 extended_attribut es={'Default': 'Undefined'})], 397 extended_attribut es={'Default': 'Undefined'})],
398 extended_attributes=forEach_extended_attributes ), 398 extended_attributes=forEach_extended_attributes ),
399 ]) 399 ]
400
401 methods_by_name = {}
402 for method in methods:
403 methods_by_name.setdefault(method['name'], []).append(method)
404
405 for implicit_method in implicit_methods:
406 if implicit_method['name'] in methods_by_name:
407 # FIXME: Check that the existing method is compatible.
408 continue
409 methods.append(implicit_method)
400 410
401 # FIXME: maplike<> and setlike<> should also imply the presence of a 411 # FIXME: maplike<> and setlike<> should also imply the presence of a
402 # subset of keys(), values(), entries(), forEach(), has(), get(), add(), 412 # subset of keys(), values(), entries(), forEach(), has(), get(), add(),
403 # set(), delete() and clear(), and a 'size' attribute. 413 # set(), delete() and clear(), and a 'size' attribute.
404 414
405 # Stringifier 415 # Stringifier
406 if interface.stringifier: 416 if interface.stringifier:
407 stringifier = interface.stringifier 417 stringifier = interface.stringifier
408 stringifier_ext_attrs = stringifier.extended_attributes.copy() 418 stringifier_ext_attrs = stringifier.extended_attributes.copy()
409 if stringifier.attribute: 419 if stringifier.attribute:
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 if str(idl_type) != 'boolean': 1245 if str(idl_type) != 'boolean':
1236 raise Exception( 1246 raise Exception(
1237 'Only deleters with boolean type are allowed, but type is "%s"' % 1247 'Only deleters with boolean type are allowed, but type is "%s"' %
1238 idl_type) 1248 idl_type)
1239 extended_attributes = deleter.extended_attributes 1249 extended_attributes = deleter.extended_attributes
1240 return { 1250 return {
1241 'is_custom': 'Custom' in extended_attributes, 1251 'is_custom': 'Custom' in extended_attributes,
1242 'is_raises_exception': 'RaisesException' in extended_attributes, 1252 'is_raises_exception': 'RaisesException' in extended_attributes,
1243 'name': cpp_name(deleter), 1253 'name': cpp_name(deleter),
1244 } 1254 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/core/TestInterface3.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698