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

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

Issue 12082122: Add supported checks to the SVG library, and library cleanup. (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
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 support_check = self.GetSupportCheck() 35 check = self.GetSupportCheck()
36 if type(check) != tuple:
37 signature = 'get supported'
38 else:
39 signature = check[0]
40 check = check[1]
36 self._members_emitter.Emit('\n' 41 self._members_emitter.Emit('\n'
37 ' /// Checks if this type is supported on the current platform.\n' 42 ' /// Checks if this type is supported on the current platform.\n'
38 ' static bool get supported => $SUPPORT_CHECK;\n', 43 ' static bool $SIGNATURE => $SUPPORT_CHECK;\n',
39 SUPPORT_CHECK=support_check) 44 SIGNATURE=signature, SUPPORT_CHECK=check)
40 45
41 def EmitEventGetter(self, events_class_name): 46 def EmitEventGetter(self, events_class_name):
42 self._members_emitter.Emit( 47 self._members_emitter.Emit(
43 "\n @DocsEditable" 48 "\n @DocsEditable"
44 "\n @DomName('EventTarget.addEventListener, " 49 "\n @DomName('EventTarget.addEventListener, "
45 "EventTarget.removeEventListener, EventTarget.dispatchEvent')" 50 "EventTarget.removeEventListener, EventTarget.dispatchEvent')"
46 "\n @deprecated" 51 "\n @deprecated"
47 "\n $TYPE get on =>\n new $TYPE(this);\n", 52 "\n $TYPE get on =>\n new $TYPE(this);\n",
48 TYPE=events_class_name) 53 TYPE=events_class_name)
49 54
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 walk(interface.parents) 534 walk(interface.parents)
530 else: 535 else:
531 walk(interface.parents[1:]) 536 walk(interface.parents[1:])
532 return result 537 return result
533 538
534 def _DartType(self, type_name): 539 def _DartType(self, type_name):
535 return self._type_registry.DartType(type_name) 540 return self._type_registry.DartType(type_name)
536 541
537 def _IsPrivate(self, name): 542 def _IsPrivate(self, name):
538 return name.startswith('_') 543 return name.startswith('_')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698