Index: tools/dom/scripts/htmldartgenerator.py |
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py |
index 62056e7372a046fda358ba223c8aad680b8e6b09..53be964e59dea1aabe6ff74ca98d441f7afce4a8 100644 |
--- a/tools/dom/scripts/htmldartgenerator.py |
+++ b/tools/dom/scripts/htmldartgenerator.py |
@@ -393,11 +393,13 @@ class HtmlDartGenerator(object): |
generate_call(stmts_emitter, call_emitter, |
version[0], signature_index, argument_count) |
+ def IsTypeChecking(interface_argument): |
+ return 'LegacyInterfaceTypeChecking' in interface_argument.ext_attrs or \ |
+ self._database.HasInterface(interface_argument.id) |
+ |
def GenerateChecksAndCall(signature_index, argument_count): |
checks = [] |
- typechecked_interface = \ |
- ('TypeChecking' in self._interface.ext_attrs) and \ |
- ('Interface' in self._interface.ext_attrs['TypeChecking']) |
+ typechecked_interface = IsTypeChecking(self._interface) |
for i in reversed(range(0, argument_count)): |
argument = signatures[signature_index][i] |
@@ -408,9 +410,7 @@ class HtmlDartGenerator(object): |
if test_type in ['dynamic', 'Object']: |
checks.append('%s != null' % parameter_name) |
elif not can_omit_type_check(test_type, i): |
- typechecked = typechecked_interface or \ |
- ('TypeChecking' in argument.ext_attrs) and \ |
- ('Interface' in argument.ext_attrs['TypeChecking']) |
+ typechecked = typechecked_interface or IsTypeChecking(argument) |
converts_null = \ |
('TreatNullAs' in argument.ext_attrs) or \ |
(argument.default_value is not None) or \ |
@@ -541,9 +541,10 @@ class HtmlDartGenerator(object): |
def _AddConstructor(self, |
constructor_info, factory_name, factory_constructor_name): |
- # Hack to ignore the Image constructor used by JavaScript. |
+ # Hack to ignore the constructor used by JavaScript. |
if ((self._interface.id == 'HTMLImageElement' or |
self._interface.id == 'Blob' or |
+ self._interface.id == 'TouchEvent' or |
self._interface.id == 'DOMException') |
and not constructor_info.pure_dart_constructor): |
return |