Chromium Code Reviews| 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..4863f9effa7f68fb1eda799638a3ff2b300cd50a 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/, Section 4.5.1.1 (step 10.11) |
|
Jens Widell
2014/06/20 08:07:06
Add "#es-interface-call" to the link, instead of t
sof
2014/06/20 08:15:09
Done.
|
| + # (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: |