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

Unified Diff: Source/bindings/scripts/v8_interface.py

Issue 284163002: Better arity checks for overloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Return properly 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/vibration/vibration-exceptions-expected.txt ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index b563e9796057ac6717551b0bbdd5fca895b7d82a..01cc1ac3a66aaaf65c35356bf13f5e2f13c9076e 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -355,16 +355,21 @@ def generate_overloads(overloads):
method['overload_index'] = index
effective_overloads_by_length = effective_overload_set_by_length(overloads)
+ lengths = [length for length, _ in effective_overloads_by_length]
return {
'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [DeprecateAs]
'length_tests_methods': length_tests_methods(effective_overloads_by_length),
+ 'minarg': lengths[0],
# 1. Let maxarg be the length of the longest type list of the
# entries in S.
- 'maxarg': max(i for i, _ in effective_overloads_by_length),
+ 'maxarg': lengths[-1],
'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs]
- 'minimum_number_of_required_arguments':
- min(method['number_of_required_arguments'] for method in overloads),
+ 'valid_arities': lengths
+ # Only need to report valid arities if there is a gap in the
+ # sequence of possible lengths, otherwise invalid length means
+ # "not enough arguments".
+ if lengths[-1] - lengths[0] != len(lengths) - 1 else None,
}
« no previous file with comments | « LayoutTests/vibration/vibration-exceptions-expected.txt ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698