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

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

Issue 605083004: Merge 38 changes to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/databasebuilder.py ('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/generator.py
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 59c545882a58bdadacc342f5893d859ff5fbd902..d8ecaa20545d063e37155632a43215611af288bb 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -114,7 +114,6 @@ _dart2js_dom_custom_native_specs = monitored.Dict(
'ChannelMergerNode': 'ChannelMergerNode,AudioChannelMerger',
'ChannelSplitterNode': 'ChannelSplitterNode,AudioChannelSplitter',
- 'ClientRect': 'ClientRect,DOMRect',
'ClientRectList': 'ClientRectList,DOMRectList',
'CSSStyleDeclaration':
@@ -239,9 +238,9 @@ def _BuildArguments(args, interface, constructor=False):
return '_OR_'.join(sorted(set(arg.id for arg in args)))
def DartType(idl_type_name):
- if idl_type_name in _idl_type_registry:
- return _idl_type_registry[idl_type_name].dart_type or idl_type_name
- return idl_type_name
+ if idl_type_name in _idl_type_registry:
+ return _idl_type_registry[idl_type_name].dart_type or idl_type_name
+ return idl_type_name
# Given a list of overloaded arguments, choose a suitable type.
def OverloadedType(args):
@@ -264,12 +263,15 @@ def _BuildArguments(args, interface, constructor=False):
return result
-# Argument default value set (literal value or null).
-def HasDefault(argument):
- return (argument.default_value != None) or argument.default_value_is_null
+# Argument default value is one that we suppress
+# FIXME(leafp) We may wish to eliminate this special treatment of optional
+# arguments entirely, since default values are being used more pervasively
+# in the IDL now.
+def HasSuppressedOptionalDefault(argument):
+ return (argument.default_value == 'Undefined') or argument.default_value_is_null
def IsOptional(argument):
- return argument.optional and (not(HasDefault(argument))) \
+ return argument.optional and (not(HasSuppressedOptionalDefault(argument))) \
or 'DartForceOptional' in argument.ext_attrs
def AnalyzeOperation(interface, operations):
@@ -450,7 +452,7 @@ class OperationInfo(object):
else:
if optional:
raise Exception('Optional parameters cannot precede required ones: '
- + str(params))
+ + str(param_info))
required.append(FormatParam(param_info))
needs_named = optional and self.requires_named_arguments and not force_optional
return (required, optional, needs_named)
@@ -1273,7 +1275,7 @@ class TypeRegistry(object):
return self.TypeInfo(type_name).dart_type()
def _TypeInfo(self, type_name):
- match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name)
+ match = re.match(r'(?:sequence<([\w ]+)>|(\w+)\[\])$', type_name)
if match:
type_data = TypeData('Sequence')
item_info = self.TypeInfo(match.group(1) or match.group(2))
« no previous file with comments | « tools/dom/scripts/databasebuilder.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698