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

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

Issue 25585002: Make OptionElement construtor arguments named optional parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, \
11 DartDomNameOfAttribute, FindMatchingAttribute, \ 11 DartDomNameOfAttribute, FindMatchingAttribute, \
12 TypeOrNothing, ConvertToFuture, GetCallbackInfo 12 TypeOrNothing, ConvertToFuture, GetCallbackInfo
13 from copy import deepcopy 13 from copy import deepcopy
14 from htmlrenamer import convert_to_future_members, keep_overloaded_members, \ 14 from htmlrenamer import convert_to_future_members, custom_html_constructors, \
15 private_html_members, dom_private_html_members, renamed_html_members, rename d_overloads, \ 15 keep_overloaded_members, private_html_members, dom_private_html_members, ren amed_html_members, \
16 removed_html_members 16 renamed_overloads, removed_html_members
17 import logging 17 import logging
18 import monitored 18 import monitored
19 import sys 19 import sys
20 20
21 _logger = logging.getLogger('htmldartgenerator') 21 _logger = logging.getLogger('htmldartgenerator')
22 22
23 # Types that are accessible cross-frame in a limited fashion. 23 # Types that are accessible cross-frame in a limited fashion.
24 # In these cases, the base type (e.g., WindowBase) provides restricted access 24 # In these cases, the base type (e.g., WindowBase) provides restricted access
25 # while the subtype (e.g., Window) provides full access to the 25 # while the subtype (e.g., Window) provides full access to the
26 # corresponding objects if there are from the same frame. 26 # corresponding objects if there are from the same frame.
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 info.callback_args[1].is_optional else ''))), 591 info.callback_args[1].is_optional else ''))),
592 FUTURE_GENERIC = ('' if len(callback_info.param_infos) == 0 or 592 FUTURE_GENERIC = ('' if len(callback_info.param_infos) == 0 or
593 not callback_info.param_infos[0].type_id else 593 not callback_info.param_infos[0].type_id else
594 '<%s>' % self._DartType(callback_info.param_infos[0].type_id)), 594 '<%s>' % self._DartType(callback_info.param_infos[0].type_id)),
595 ORIGINAL_FUNCTION = html_name) 595 ORIGINAL_FUNCTION = html_name)
596 596
597 def EmitHelpers(self, base_class): 597 def EmitHelpers(self, base_class):
598 if not self._members_emitter: 598 if not self._members_emitter:
599 return 599 return
600 600
601 if base_class != self.RootClassName(): 601 if (base_class != self.RootClassName() and
602 self._interface.id not in custom_html_constructors):
602 self._members_emitter.Emit( 603 self._members_emitter.Emit(
603 ' // To suppress missing implicit constructor warnings.\n' 604 ' // To suppress missing implicit constructor warnings.\n'
604 ' factory $CLASSNAME._() { ' 605 ' factory $CLASSNAME._() { '
605 'throw new UnsupportedError("Not supported"); }\n', 606 'throw new UnsupportedError("Not supported"); }\n',
606 CLASSNAME=self._interface_type_info.implementation_name()) 607 CLASSNAME=self._interface_type_info.implementation_name())
607 608
608 def DeclareAttribute(self, attribute, type_name, attr_name, read_only): 609 def DeclareAttribute(self, attribute, type_name, attr_name, read_only):
609 """ Declares an attribute but does not include the code to invoke it. 610 """ Declares an attribute but does not include the code to invoke it.
610 """ 611 """
611 if read_only: 612 if read_only:
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 695
695 def SecureBaseName(self, type_name): 696 def SecureBaseName(self, type_name):
696 if type_name in _secure_base_types: 697 if type_name in _secure_base_types:
697 return _secure_base_types[type_name] 698 return _secure_base_types[type_name]
698 699
699 def _DartType(self, type_name): 700 def _DartType(self, type_name):
700 return self._type_registry.DartType(type_name) 701 return self._type_registry.DartType(type_name)
701 702
702 def _TypeInfo(self, type_name): 703 def _TypeInfo(self, type_name):
703 return self._type_registry.TypeInfo(type_name) 704 return self._type_registry.TypeInfo(type_name)
OLDNEW
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698