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: |