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

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

Issue 289843006: Avoid extra arity and type check on distinguishing argument (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: additional test Created 6 years, 7 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 methods = [effective_overload[0] 607 methods = [effective_overload[0]
608 for effective_overload in effective_overloads] 608 for effective_overload in effective_overloads]
609 if len(methods) == 1: 609 if len(methods) == 1:
610 # If only one method with a given length, no test needed 610 # If only one method with a given length, no test needed
611 yield ('true', methods[0]) 611 yield ('true', methods[0])
612 return 612 return
613 613
614 # 6. If there is more than one entry in S, then set d to be the 614 # 6. If there is more than one entry in S, then set d to be the
615 # distinguishing argument index for the entries of S. 615 # distinguishing argument index for the entries of S.
616 index = distinguishing_argument_index(effective_overloads) 616 index = distinguishing_argument_index(effective_overloads)
617 for method in methods:
618 method['distinguishing_argument_index'] = index
619
617 # (7-9 are for handling |undefined| values for optional arguments before 620 # (7-9 are for handling |undefined| values for optional arguments before
618 # the distinguishing argument (as “missing”), so you can specify only some 621 # the distinguishing argument (as “missing”), so you can specify only some
619 # optional arguments. We don’t support this, so we skip these steps.) 622 # optional arguments. We don’t support this, so we skip these steps.)
620 # 10. If i = d, then: 623 # 10. If i = d, then:
621 # (d is the distinguishing argument index) 624 # (d is the distinguishing argument index)
622 # 1. Let V be argi. 625 # 1. Let V be argi.
623 # Note: This is the argument that will be used to resolve which 626 # Note: This is the argument that will be used to resolve which
624 # overload is selected. 627 # overload is selected.
625 cpp_value = 'info[%s]' % index 628 cpp_value = 'info[%s]' % index
626 629
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 deleter = next( 1122 deleter = next(
1120 method 1123 method
1121 for method in interface.operations 1124 for method in interface.operations
1122 if ('deleter' in method.specials and 1125 if ('deleter' in method.specials and
1123 len(method.arguments) == 1 and 1126 len(method.arguments) == 1 and
1124 str(method.arguments[0].idl_type) == 'DOMString')) 1127 str(method.arguments[0].idl_type) == 'DOMString'))
1125 except StopIteration: 1128 except StopIteration:
1126 return None 1129 return None
1127 1130
1128 return property_deleter(deleter) 1131 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | Source/bindings/tests/idls/TestObject.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698