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

Unified Diff: tools/dom/scripts/htmldartgenerator.py

Issue 1682783002: Dartium 45 roll (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: removed Created 4 years, 10 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 | « tools/dom/scripts/go.sh ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/htmldartgenerator.py
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index e7e500f19de43d1dfafec1a34325d69d6956e321..b93b0ca9ebdd905b1c1b8a5cd2365bbab33a7084 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -311,6 +311,11 @@ class HtmlDartGenerator(object):
self.EmitAttribute(attribute, attr_name, read_only)
def AddOperation(self, info, declare_only=False, dart_js_interop=False):
+ # TODO(terry): Hack window has 2 overloaded getter one returns Window and
+ # and other object (we'll always return Window)?
+ if self._interface.id == "Window" and info.name == '__getter__':
+ info.operations[1].type = info.operations[0].type;
+
""" Adds an operation to the generated class.
Arguments:
info - The operation info of the operation to be added.
@@ -528,7 +533,9 @@ class HtmlDartGenerator(object):
def _AddConstructor(self,
constructor_info, factory_name, factory_constructor_name):
# Hack to ignore the Image constructor used by JavaScript.
- if ((self._interface.id == 'HTMLImageElement' or self._interface.id == 'Blob')
+ if ((self._interface.id == 'HTMLImageElement' or
+ self._interface.id == 'Blob' or
+ self._interface.id == 'DOMException')
and not constructor_info.pure_dart_constructor):
return
@@ -850,17 +857,20 @@ class HtmlDartGenerator(object):
verified_type = temp_type # verified by assignment in checked mode.
else:
converted_arguments.append(info.param_infos[position].name)
- param_type = self._NarrowInputType(arg.type.id)
- # Verified by argument checking on entry to the dispatcher.
-
- verified_type = self._InputType(
- info.param_infos[position].type_id, info)
- # The native method does not need an argument type if we know the type.
- # But we do need the native methods to have correct function types, so
- # be conservative.
- if param_type == verified_type:
- if param_type in ['String', 'num', 'int', 'double', 'bool', 'Object']:
- param_type = 'dynamic'
+ if self._database.HasTypeDef(arg.type.id):
+ param_type = 'dynamic'
+ else:
+ param_type = self._NarrowInputType(arg.type.id)
+ # Verified by argument checking on entry to the dispatcher.
+
+ verified_type = self._InputType(
+ info.param_infos[position].type_id, info)
+ # The native method does not need an argument type if we know the type.
+ # But we do need the native methods to have correct function types, so
+ # be conservative.
+ if param_type == verified_type:
+ if param_type in ['String', 'num', 'int', 'double', 'bool', 'Object']:
+ param_type = 'dynamic'
target_parameters.append(
'%s%s' % (TypeOrNothing(param_type), param_name))
@@ -872,4 +882,8 @@ class HtmlDartGenerator(object):
if conversion:
return conversion.input_type
else:
- return self._NarrowInputType(type_name) if type_name else 'dynamic'
+ # If typedef it's a union return dynamic.
+ if self._database.HasTypeDef(type_name):
+ return 'dynamic'
+ else:
+ return self._NarrowInputType(type_name) if type_name else 'dynamic'
« no previous file with comments | « tools/dom/scripts/go.sh ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698