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

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

Issue 715353002: IDL: Support callback function types in overload resolution (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/TestObject.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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 # • an interface type that V implements 835 # • an interface type that V implements
836 # (Unlike most of these tests, this can return multiple methods, since we 836 # (Unlike most of these tests, this can return multiple methods, since we
837 # test if it implements an interface. Thus we need a for loop, not a next.) 837 # test if it implements an interface. Thus we need a for loop, not a next.)
838 # (We distinguish wrapper types from built-in interface types.) 838 # (We distinguish wrapper types from built-in interface types.)
839 for idl_type, method in ((idl_type, method) 839 for idl_type, method in ((idl_type, method)
840 for idl_type, method in idl_types_methods 840 for idl_type, method in idl_types_methods
841 if idl_type.is_wrapper_type): 841 if idl_type.is_wrapper_type):
842 test = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.forma t(idl_type=idl_type.base_type, cpp_value=cpp_value) 842 test = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.forma t(idl_type=idl_type.base_type, cpp_value=cpp_value)
843 yield test, method 843 yield test, method
844 844
845 # 8. Otherwise: if V is any kind of object except for a native Date object, 845 # 13. Otherwise: if IsCallable(V) is true, and there is an entry in S that
846 # has one of the following types at position i of its type list,
847 # • a callback function type
848 # ...
849 #
850 # FIXME:
851 # We test for functions rather than callability, which isn't strictly the
852 # same thing.
853 try:
854 method = next(method for idl_type, method in idl_types_methods
855 if idl_type.is_callback_function)
856 test = '%s->IsFunction()' % cpp_value
857 yield test, method
858 except StopIteration:
859 pass
860
861 # 14. Otherwise: if V is any kind of object except for a native Date object,
862 # a native RegExp object, and there is an entry in S that has one of the
863 # following types at position i of its type list,
864 # • a sequence type
865 # ...
866 #
867 # 15. Otherwise: if V is any kind of object except for a native Date object,
846 # a native RegExp object, and there is an entry in S that has one of the 868 # a native RegExp object, and there is an entry in S that has one of the
847 # following types at position i of its type list, 869 # following types at position i of its type list,
848 # • an array type 870 # • an array type
849 # • a sequence type
850 # ... 871 # ...
851 # • a dictionary 872 # • a dictionary
852 # 873 #
853 # FIXME: 874 # FIXME:
854 # We don't strictly follow the algorithm here. The algorithm says "remove 875 # We don't strictly follow the algorithm here. The algorithm says "remove
855 # all other entries" if there is "one entry" matching, but we yield all 876 # all other entries" if there is "one entry" matching, but we yield all
856 # entries to support following constructors: 877 # entries to support following constructors:
857 # [constructor(sequence<DOMString> arg), constructor(Dictionary arg)] 878 # [constructor(sequence<DOMString> arg), constructor(Dictionary arg)]
858 # interface I { ... } 879 # interface I { ... }
859 # (Need to check array types before objects because an array is an object) 880 # (Need to check array types before objects because an array is an object)
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 deleter = next( 1239 deleter = next(
1219 method 1240 method
1220 for method in interface.operations 1241 for method in interface.operations
1221 if ('deleter' in method.specials and 1242 if ('deleter' in method.specials and
1222 len(method.arguments) == 1 and 1243 len(method.arguments) == 1 and
1223 str(method.arguments[0].idl_type) == 'DOMString')) 1244 str(method.arguments[0].idl_type) == 'DOMString'))
1224 except StopIteration: 1245 except StopIteration:
1225 return None 1246 return None
1226 1247
1227 return property_deleter(deleter) 1248 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698