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

Side by Side Diff: client/dom/scripts/dartgenerator.py

Issue 9381030: Let EventTarget be a base class in the frog dom. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: EventsTest passes Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module generates Dart APIs from the IDL database.""" 6 """This module generates Dart APIs from the IDL database."""
7 7
8 import emitter 8 import emitter
9 import idlnode 9 import idlnode
10 import logging 10 import logging
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 1981
1982 def StartInterface(self): 1982 def StartInterface(self):
1983 interface = self._interface 1983 interface = self._interface
1984 interface_name = interface.id 1984 interface_name = interface.id
1985 1985
1986 self._class_name = self._ImplClassName(interface_name) 1986 self._class_name = self._ImplClassName(interface_name)
1987 1987
1988 base = None 1988 base = None
1989 if interface.parents: 1989 if interface.parents:
1990 supertype = interface.parents[0].type.id 1990 supertype = interface.parents[0].type.id
1991 # FIXME: We're currently injecting List<..> and EventTarget as
1992 # supertypes in dart.idl. We should annotate/preserve as
1993 # attributes instead. For now, this hack lets the interfaces
1994 # inherit, but not the classes.
1995 if (not _IsDartListType(supertype) and
1996 not supertype == 'EventTarget'):
1997 base = self._ImplClassName(supertype)
1998 if _IsDartCollectionType(supertype): 1991 if _IsDartCollectionType(supertype):
1999 # List methods are injected in AddIndexer. 1992 # List methods are injected in AddIndexer.
2000 pass 1993 pass
2001 elif supertype == 'EventTarget':
2002 # Most implementors of EventTarget specify the EventListener operations
2003 # again. If the operations are not specified, try to inherit from the
2004 # EventTarget implementation.
2005 #
2006 # Applies to MessagePort.
2007 if not [op for op in interface.operations if op.id == 'addEventListener' ]:
2008 base = self._ImplClassName(supertype)
2009 else: 1994 else:
2010 base = self._ImplClassName(supertype) 1995 base = self._ImplClassName(supertype)
2011 1996
2012 if interface_name in _frog_dom_custom_native_specs: 1997 if interface_name in _frog_dom_custom_native_specs:
2013 native_spec = _frog_dom_custom_native_specs[interface_name] 1998 native_spec = _frog_dom_custom_native_specs[interface_name]
2014 else: 1999 else:
2015 # Make the class 'hidden' so it is dynamically patched at runtime. This 2000 # Make the class 'hidden' so it is dynamically patched at runtime. This
2016 # is useful not only for browser compat, but to allow code that links 2001 # is useful not only for browser compat, but to allow code that links
2017 # against dart:dom to load in a worker isolate. 2002 # against dart:dom to load in a worker isolate.
2018 native_spec = '*' + interface_name 2003 native_spec = '*' + interface_name
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 INDENT=indent, 2489 INDENT=indent,
2505 NATIVENAME=native_name, 2490 NATIVENAME=native_name,
2506 ARGS=argument_expressions) 2491 ARGS=argument_expressions)
2507 2492
2508 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native ' 2493 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native '
2509 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n', 2494 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n',
2510 NATIVE_NAME=native_name, 2495 NATIVE_NAME=native_name,
2511 TYPE=info.type_name, 2496 TYPE=info.type_name,
2512 PARAMS=', '.join(arg_names), 2497 PARAMS=', '.join(arg_names),
2513 INTERFACE=self._interface.id) 2498 INTERFACE=self._interface.id)
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/XMLHttpRequestUpload.dart ('k') | client/tests/client/client.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698