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

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

Issue 1057453002: bindings: Throw TypeError when required dictionary member is undefined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_dictionary.py
diff --git a/Source/bindings/scripts/v8_dictionary.py b/Source/bindings/scripts/v8_dictionary.py
index 1d1f2f435ff71e159d91b6a0e3c97bbe355b78cf..45de469ccc9a0cc61ba054fa7f1e0becb796cbfc 100644
--- a/Source/bindings/scripts/v8_dictionary.py
+++ b/Source/bindings/scripts/v8_dictionary.py
@@ -80,6 +80,10 @@ def member_context(dictionary, member):
idl_type.add_includes_for_type()
unwrapped_idl_type = unwrap_nullable_if_needed(idl_type)
+ if member.is_required and member.default_value:
+ raise Exception(
+ 'Required member %s must not have a default value.' % member.name)
+
def default_values():
if not member.default_value:
return None, None
@@ -110,6 +114,7 @@ def member_context(dictionary, member):
'is_interface_type': idl_type.is_interface_type and not idl_type.is_dictionary,
'is_nullable': idl_type.is_nullable,
'is_object': unwrapped_idl_type.name == 'Object',
+ 'is_required': member.is_required,
'name': member.name,
'setter_name': setter_name_for_dictionary_member(member),
'null_setter_name': null_setter_name_for_dictionary_member(member),
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698