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

Side by Side Diff: tools/dom/scripts/htmldartgenerator.py

Issue 17063007: Making all DOM types abstract and removing superfluous Dartium constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 provides shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 dart:html APIs from the IDL database.""" 7 dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 from generator import AnalyzeOperation, ConstantOutputOrder, \ 10 from generator import AnalyzeOperation, ConstantOutputOrder, \
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 (',\n %s(error) { completer.completeError(error); }' % 484 (',\n %s(error) { completer.completeError(error); }' %
485 ('%s : ' % info.callback_args[1].name 485 ('%s : ' % info.callback_args[1].name
486 if info.requires_named_arguments and 486 if info.requires_named_arguments and
487 info.callback_args[1].is_optional else ''))), 487 info.callback_args[1].is_optional else ''))),
488 FUTURE_GENERIC = ('' if len(callback_info.param_infos) == 0 or 488 FUTURE_GENERIC = ('' if len(callback_info.param_infos) == 0 or
489 not callback_info.param_infos[0].type_id else 489 not callback_info.param_infos[0].type_id else
490 '<%s>' % self._DartType(callback_info.param_infos[0].type_id)), 490 '<%s>' % self._DartType(callback_info.param_infos[0].type_id)),
491 ORIGINAL_FUNCTION = html_name) 491 ORIGINAL_FUNCTION = html_name)
492 492
493 def EmitHelpers(self, base_class): 493 def EmitHelpers(self, base_class):
494 pass 494 if not self._members_emitter:
495 return
496
497 self._members_emitter.Emit(
498 ' // To suppress missing implicit constructor warnings.\n'
499 ' factory $CLASSNAME._() { '
500 'throw new UnsupportedError("Not supported"); }\n',
501 CLASSNAME=self._interface_type_info.implementation_name())
495 502
496 def DeclareAttribute(self, attribute, type_name, attr_name, read_only): 503 def DeclareAttribute(self, attribute, type_name, attr_name, read_only):
497 """ Declares an attribute but does not include the code to invoke it. 504 """ Declares an attribute but does not include the code to invoke it.
498 """ 505 """
499 if read_only: 506 if read_only:
500 template = '\n $TYPE get $NAME;\n' 507 template = '\n $TYPE get $NAME;\n'
501 else: 508 else:
502 template = '\n $TYPE $NAME;\n' 509 template = '\n $TYPE $NAME;\n'
503 510
504 self._members_emitter.Emit(template, 511 self._members_emitter.Emit(template,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 if interface.parents: 592 if interface.parents:
586 parent = interface.parents[0] 593 parent = interface.parents[0]
587 if IsPureInterface(parent.type.id): 594 if IsPureInterface(parent.type.id):
588 walk(interface.parents) 595 walk(interface.parents)
589 else: 596 else:
590 walk(interface.parents[1:]) 597 walk(interface.parents[1:])
591 return result 598 return result
592 599
593 def _DartType(self, type_name): 600 def _DartType(self, type_name):
594 return self._type_registry.DartType(type_name) 601 return self._type_registry.DartType(type_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698