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

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

Issue 338893004: Extend ScalarValueString handling to include constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tweaks Created 6 years, 6 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 | « no previous file | Source/bindings/scripts/v8_attributes.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/idl_types.py
diff --git a/Source/bindings/scripts/idl_types.py b/Source/bindings/scripts/idl_types.py
index e488e33264830157b37294bf42dd24c86ce5ac9d..9de8efc16d3feaba5c400b431b04c6217290b98a 100644
--- a/Source/bindings/scripts/idl_types.py
+++ b/Source/bindings/scripts/idl_types.py
@@ -70,6 +70,14 @@ TYPE_NAMES = {
'Date': 'Date',
}
+STRING_TYPES = frozenset([
+ # http://heycam.github.io/webidl/#es-interface-call (step 10.11)
+ # (Interface object [[Call]] method's string types.)
+ 'String',
+ 'ByteString',
+ 'ScalarValueString',
+])
+
################################################################################
# Inheritance
@@ -195,17 +203,30 @@ class IdlType(object):
self.name == 'Promise') # Promise will be basic in future
@property
+ def is_string_type(self):
+ return self.base_type_name in STRING_TYPES
+
+ @property
+ def may_raise_exception_on_conversion(self):
+ return (self.is_integer_type or
+ self.name in ('ByteString', 'ScalarValueString'))
+
+ @property
def is_union_type(self):
return isinstance(self, IdlUnionType)
@property
+ def base_type_name(self):
+ base_type = self.base_type
+ return TYPE_NAMES.get(base_type, base_type)
+
+ @property
def name(self):
"""Return type name.
http://heycam.github.io/webidl/#dfn-type-name
"""
- base_type = self.base_type
- base_type_name = TYPE_NAMES.get(base_type, base_type)
+ base_type_name = self.base_type_name
if self.is_array:
return base_type_name + 'Array'
if self.is_sequence:
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_attributes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698