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

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

Issue 12095088: "Reverting 17940" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« 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, \
(...skipping 14 matching lines...) Expand all
25 class HtmlDartGenerator(object): 25 class HtmlDartGenerator(object):
26 def __init__(self, interface, options): 26 def __init__(self, interface, options):
27 self._database = options.database 27 self._database = options.database
28 self._interface = interface 28 self._interface = interface
29 self._type_registry = options.type_registry 29 self._type_registry = options.type_registry
30 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) 30 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id)
31 self._renamer = options.renamer 31 self._renamer = options.renamer
32 32
33 def EmitSupportCheck(self): 33 def EmitSupportCheck(self):
34 if self.HasSupportCheck(): 34 if self.HasSupportCheck():
35 check = self.GetSupportCheck() 35 support_check = self.GetSupportCheck()
36 if type(check) != tuple:
37 signature = 'get supported'
38 else:
39 signature = check[0]
40 check = check[1]
41 self._members_emitter.Emit('\n' 36 self._members_emitter.Emit('\n'
42 ' /// Checks if this type is supported on the current platform.\n' 37 ' /// Checks if this type is supported on the current platform.\n'
43 ' static bool $SIGNATURE => $SUPPORT_CHECK;\n', 38 ' static bool get supported => $SUPPORT_CHECK;\n',
44 SIGNATURE=signature, SUPPORT_CHECK=check) 39 SUPPORT_CHECK=support_check)
45 40
46 def EmitEventGetter(self, events_class_name): 41 def EmitEventGetter(self, events_class_name):
47 self._members_emitter.Emit( 42 self._members_emitter.Emit(
48 "\n @DocsEditable" 43 "\n @DocsEditable"
49 "\n @DomName('EventTarget.addEventListener, " 44 "\n @DomName('EventTarget.addEventListener, "
50 "EventTarget.removeEventListener, EventTarget.dispatchEvent')" 45 "EventTarget.removeEventListener, EventTarget.dispatchEvent')"
51 "\n @deprecated" 46 "\n @deprecated"
52 "\n $TYPE get on =>\n new $TYPE(this);\n", 47 "\n $TYPE get on =>\n new $TYPE(this);\n",
53 TYPE=events_class_name) 48 TYPE=events_class_name)
54 49
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 walk(interface.parents) 529 walk(interface.parents)
535 else: 530 else:
536 walk(interface.parents[1:]) 531 walk(interface.parents[1:])
537 return result 532 return result
538 533
539 def _DartType(self, type_name): 534 def _DartType(self, type_name):
540 return self._type_registry.DartType(type_name) 535 return self._type_registry.DartType(type_name)
541 536
542 def _IsPrivate(self, name): 537 def _IsPrivate(self, name):
543 return name.startswith('_') 538 return name.startswith('_')
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