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

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

Issue 9342008: start of code to generate dart:html using dart:dom scripts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 """ 369 """
370 370
371 self._emitters = multiemitter.MultiEmitter() 371 self._emitters = multiemitter.MultiEmitter()
372 self._database = database 372 self._database = database
373 self._output_dir = output_dir 373 self._output_dir = output_dir
374 374
375 self._ComputeInheritanceClosure() 375 self._ComputeInheritanceClosure()
376 376
377 self._systems = [] 377 self._systems = []
378 378
379 # TODO(jmesserly): only create these if needed
379 interface_system = InterfacesSystem( 380 interface_system = InterfacesSystem(
380 TemplateLoader(self._template_dir, ['dom/interface', 'dom', '']), 381 TemplateLoader(self._template_dir, ['dom/interface', 'dom', '']),
381 self._database, self._emitters, self._output_dir) 382 self._database, self._emitters, self._output_dir)
382 self._systems.append(interface_system) 383 self._systems.append(interface_system)
383 384
385 html_interface_system = HtmlInterfacesSystem(
386 TemplateLoader(self._template_dir, ['html/interface', 'html', '']),
387 self._database, self._emitters, self._output_dir)
388 self._systems.append(html_interface_system)
389
384 if 'native' in systems: 390 if 'native' in systems:
385 native_system = NativeImplementationSystem( 391 native_system = NativeImplementationSystem(
386 TemplateLoader(self._template_dir, ['dom/native', 'dom', '']), 392 TemplateLoader(self._template_dir, ['dom/native', 'dom', '']),
387 self._database, self._emitters, self._auxiliary_dir, 393 self._database, self._emitters, self._auxiliary_dir,
388 self._output_dir) 394 self._output_dir)
389 395
390 self._systems.append(native_system) 396 self._systems.append(native_system)
391 397
392 if 'wrapping' in systems: 398 if 'wrapping' in systems:
393 wrapping_system = WrappingImplementationSystem( 399 wrapping_system = WrappingImplementationSystem(
394 TemplateLoader(self._template_dir, ['dom/wrapping', 'dom', '']), 400 TemplateLoader(self._template_dir, ['dom/wrapping', 'dom', '']),
395 self._database, self._emitters, self._output_dir) 401 self._database, self._emitters, self._output_dir)
396 402
397 # Makes interface files available for listing in the library for the 403 # Makes interface files available for listing in the library for the
398 # wrapping implementation. 404 # wrapping implementation.
399 wrapping_system._interface_system = interface_system 405 wrapping_system._interface_system = interface_system
400 self._systems.append(wrapping_system) 406 self._systems.append(wrapping_system)
401 407
402 if 'frog' in systems: 408 if 'frog' in systems:
403 frog_system = FrogSystem( 409 frog_system = FrogSystem(
404 TemplateLoader(self._template_dir, ['dom/frog', 'dom', '']), 410 TemplateLoader(self._template_dir, ['dom/frog', 'dom', '']),
405 self._database, self._emitters, self._output_dir) 411 self._database, self._emitters, self._output_dir)
406 412
407 frog_system._interface_system = interface_system 413 frog_system._interface_system = interface_system
408 self._systems.append(frog_system) 414 self._systems.append(frog_system)
409 415
416 if 'htmlfrog' in systems:
417 html_system = HtmlFrogSystem(
418 TemplateLoader(self._template_dir, ['html/frog', 'html', '']),
419 self._database, self._emitters, self._output_dir)
420
421 html_system._interface_system = html_interface_system
422 self._systems.append(html_system)
423
424 if 'htmldartium' in systems:
425 html_system = HtmlDartiumSystem(
426 TemplateLoader(self._template_dir, ['html/dartium', 'html', '']),
427 self._database, self._emitters, self._output_dir)
428
429 html_system._interface_system = html_interface_system
430 self._systems.append(html_system)
410 431
411 # Render all interfaces into Dart and save them in files. 432 # Render all interfaces into Dart and save them in files.
412 for interface in database.GetInterfaces(): 433 for interface in database.GetInterfaces():
413 434
414 super_interface = None 435 super_interface = None
415 super_name = interface.id 436 super_name = interface.id
416 437
417 if not _MatchSourceFilter(source_filter, interface): 438 if not _MatchSourceFilter(source_filter, interface):
418 # Skip this interface since it's not present in the required source 439 # Skip this interface since it's not present in the required source
419 _logger.info('Omitting interface - %s' % interface.id) 440 _logger.info('Omitting interface - %s' % interface.id)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 for system in self._systems] 487 for system in self._systems]
467 488
468 for generator in generators: 489 for generator in generators:
469 generator.StartInterface() 490 generator.StartInterface()
470 491
471 for const in sorted(interface.constants, ConstantOutputOrder): 492 for const in sorted(interface.constants, ConstantOutputOrder):
472 for generator in generators: 493 for generator in generators:
473 generator.AddConstant(const) 494 generator.AddConstant(const)
474 495
475 attributes = [attr for attr in interface.attributes 496 attributes = [attr for attr in interface.attributes
476 if not self._OmitAttribute(interface, attr)] 497 if not self._IsEventAttribute(interface, attr)]
477 for (getter, setter) in _PairUpAttributes(attributes): 498 for (getter, setter) in _PairUpAttributes(attributes):
478 for generator in generators: 499 for generator in generators:
479 generator.AddAttribute(getter, setter) 500 generator.AddAttribute(getter, setter)
480 501
502 events = _PairUpAttributes([attr for attr in interface.attributes
503 if self._IsEventAttribute(interface, attr)])
504 if events:
505 for generator in generators:
506 generator.AddEvents(events)
sra1 2012/02/07 05:06:16 AddEventAttributes would be a better name.
Jennifer Messerly 2012/02/07 21:05:14 Done.
507
481 # The implementation should define an indexer if the interface directly 508 # The implementation should define an indexer if the interface directly
482 # extends List. 509 # extends List.
483 element_type = MaybeListElementType(interface) 510 element_type = MaybeListElementType(interface)
484 if element_type: 511 if element_type:
485 for generator in generators: 512 for generator in generators:
486 generator.AddIndexer(element_type) 513 generator.AddIndexer(element_type)
487 514
488 # Group overloaded operations by id 515 # Group overloaded operations by id
489 operationsById = {} 516 operationsById = {}
490 for operation in interface.operations: 517 for operation in interface.operations:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if not any(op.id == id for op in interface.operations): 552 if not any(op.id == id for op in interface.operations):
526 operations = operationsById[id] 553 operations = operationsById[id]
527 info = _AnalyzeOperation(interface, operations) 554 info = _AnalyzeOperation(interface, operations)
528 for generator in generators: 555 for generator in generators:
529 generator.AddSecondaryOperation(parent_interface, info) 556 generator.AddSecondaryOperation(parent_interface, info)
530 557
531 for generator in generators: 558 for generator in generators:
532 generator.FinishInterface() 559 generator.FinishInterface()
533 return 560 return
534 561
535 def _OmitAttribute(self, interface, attr): 562 def _IsEventAttribute(self, interface, attr):
536 # Remove EventListener attributes like 'onclick' when addEventListener 563 # Remove EventListener attributes like 'onclick' when addEventListener
537 # is available. 564 # is available.
538 if attr.type.id == 'EventListener': 565 if attr.type.id == 'EventListener':
539 if 'EventTarget' in self._AllImplementedInterfaces(interface): 566 if 'EventTarget' in self._AllImplementedInterfaces(interface):
540 return True 567 return True
541 return False 568 return False
542 569
543 def _DefinesSameAttribute(self, interface, attr1): 570 def _DefinesSameAttribute(self, interface, attr1):
544 return any(attr1.id == attr2.id 571 return any(attr1.id == attr2.id
545 and attr1.is_fc_getter == attr2.is_fc_getter 572 and attr1.is_fc_getter == attr2.is_fc_getter
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 988
962 989
963 def _FilePathForDartInterface(self, interface_name): 990 def _FilePathForDartInterface(self, interface_name):
964 """Returns the file path of the Dart interface definition.""" 991 """Returns the file path of the Dart interface definition."""
965 return os.path.join(self._output_dir, 'src', 'interface', 992 return os.path.join(self._output_dir, 'src', 'interface',
966 '%s.dart' % interface_name) 993 '%s.dart' % interface_name)
967 994
968 995
969 # ------------------------------------------------------------------------------ 996 # ------------------------------------------------------------------------------
970 997
998 class HtmlInterfacesSystem(System):
999
1000 def __init__(self, templates, database, emitters, output_dir):
1001 super(HtmlInterfacesSystem, self).__init__(
1002 templates, database, emitters, output_dir)
1003 self._dart_interface_file_paths = []
1004
1005
1006 def InterfaceGenerator(self,
1007 interface,
1008 common_prefix,
1009 super_interface_name,
1010 source_filter):
1011 """."""
1012 interface_name = interface.id
1013 dart_interface_file_path = self._FilePathForDartInterface(interface_name)
1014
1015 self._dart_interface_file_paths.append(dart_interface_file_path)
1016
1017 dart_interface_code = self._emitters.FileEmitter(dart_interface_file_path)
1018
1019 template_file = 'interface_%s.darttemplate' % interface_name
1020 template = self._templates.TryLoad(template_file)
1021 if not template:
1022 template = self._templates.Load('interface.darttemplate')
1023
1024 return HtmlDartInterfaceGenerator(
1025 interface, dart_interface_code,
1026 template,
1027 common_prefix, super_interface_name,
1028 source_filter)
1029
1030 def ProcessCallback(self, interface, info):
1031 """Generates a typedef for the callback interface."""
1032 interface_name = interface.id
1033 file_path = self._FilePathForDartInterface(interface_name)
1034 self._ProcessCallback(interface, info, file_path)
1035
1036 def GenerateLibraries(self, lib_dir):
1037 pass
1038
1039
1040 def _FilePathForDartInterface(self, interface_name):
1041 """Returns the file path of the Dart interface definition."""
1042 # TODO(jmesserly): is this the right path
1043 return os.path.join(self._output_dir, 'html', 'interface',
1044 '%s.dart' % interface_name)
1045
1046
1047 # ------------------------------------------------------------------------------
1048
971 class WrappingImplementationSystem(System): 1049 class WrappingImplementationSystem(System):
972 1050
973 def __init__(self, templates, database, emitters, output_dir): 1051 def __init__(self, templates, database, emitters, output_dir):
974 """Prepared for generating wrapping implementation. 1052 """Prepared for generating wrapping implementation.
975 1053
976 - Creates emitter for JS code. 1054 - Creates emitter for JS code.
977 - Creates emitter for Dart code. 1055 - Creates emitter for Dart code.
978 """ 1056 """
979 super(WrappingImplementationSystem, self).__init__( 1057 super(WrappingImplementationSystem, self).__init__(
980 templates, database, emitters, output_dir) 1058 templates, database, emitters, output_dir)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 self._dart_frog_file_paths)) 1195 self._dart_frog_file_paths))
1118 1196
1119 def Finish(self): 1197 def Finish(self):
1120 pass 1198 pass
1121 1199
1122 def _FilePathForFrogImpl(self, interface_name): 1200 def _FilePathForFrogImpl(self, interface_name):
1123 """Returns the file path of the Frog implementation.""" 1201 """Returns the file path of the Frog implementation."""
1124 return os.path.join(self._output_dir, 'src', 'frog', 1202 return os.path.join(self._output_dir, 'src', 'frog',
1125 '%s.dart' % interface_name) 1203 '%s.dart' % interface_name)
1126 1204
1205
1206 # ------------------------------------------------------------------------------
1207
1208 class HtmlFrogSystem(System):
1209
1210 def __init__(self, templates, database, emitters, output_dir):
1211 super(HtmlFrogSystem, self).__init__(
1212 templates, database, emitters, output_dir)
1213 self._dart_frog_file_paths = []
1214
1215 def InterfaceGenerator(self,
1216 interface,
1217 common_prefix,
1218 super_interface_name,
1219 source_filter):
1220 """."""
1221 dart_frog_file_path = self._FilePathForFrogImpl(interface.id)
1222 self._dart_frog_file_paths.append(dart_frog_file_path)
1223
1224 template_file = 'impl_%s.darttemplate' % interface.id
1225 template = self._templates.TryLoad(template_file)
1226 if not template:
1227 template = self._templates.Load('frog_impl.darttemplate')
1228
1229 dart_code = self._emitters.FileEmitter(dart_frog_file_path)
1230 # dart_code.Emit(self._templates.Load('frog_impl.darttemplate'))
1231 return HtmlFrogInterfaceGenerator(self, interface, template,
1232 super_interface_name, dart_code)
1233
1234 #def ProcessCallback(self, interface, info):
1235 # """Generates a typedef for the callback interface."""
1236 # file_path = self._FilePathForFrogImpl(interface.id)
1237 # self._ProcessCallback(interface, info, file_path)
sra1 2012/02/07 05:06:16 remove commented out code
Jennifer Messerly 2012/02/07 21:05:14 This was also commented out in FrogSystem, so I pr
1238
1239 def GenerateLibraries(self, lib_dir):
1240 self._GenerateLibFile(
1241 'html_frog.darttemplate',
1242 os.path.join(lib_dir, 'html_frog.dart'),
1243 (self._interface_system._dart_interface_file_paths +
1244 self._interface_system._dart_callback_file_paths +
1245 self._dart_frog_file_paths))
1246
1247 def Finish(self):
1248 pass
1249
1250 def _FilePathForFrogImpl(self, interface_name):
1251 """Returns the file path of the Frog implementation."""
1252 # TODO(jmesserly): is this the right path
1253 return os.path.join(self._output_dir, 'html', 'frog',
1254 '%s.dart' % interface_name)
1255
1127 # ------------------------------------------------------------------------------ 1256 # ------------------------------------------------------------------------------
1128 1257
1129 class DartInterfaceGenerator(object): 1258 class DartInterfaceGenerator(object):
1130 """Generates Dart Interface definition for one DOM IDL interface.""" 1259 """Generates Dart Interface definition for one DOM IDL interface."""
1131 1260
1132 def __init__(self, interface, emitter, template, 1261 def __init__(self, interface, emitter, template,
1133 common_prefix, super_interface, source_filter): 1262 common_prefix, super_interface, source_filter):
1134 """Generates Dart code for the given interface. 1263 """Generates Dart code for the given interface.
1135 1264
1136 Args: 1265 Args:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 TYPE=info.type_name, 1387 TYPE=info.type_name,
1259 NAME=info.name, 1388 NAME=info.name,
1260 PARAMS=info.ParametersInterfaceDeclaration()) 1389 PARAMS=info.ParametersInterfaceDeclaration())
1261 1390
1262 # Interfaces get secondary members directly via the superinterfaces. 1391 # Interfaces get secondary members directly via the superinterfaces.
1263 def AddSecondaryAttribute(self, interface, getter, setter): 1392 def AddSecondaryAttribute(self, interface, getter, setter):
1264 pass 1393 pass
1265 1394
1266 def AddSecondaryOperation(self, interface, attr): 1395 def AddSecondaryOperation(self, interface, attr):
1267 pass 1396 pass
1268 1397 def AddEvents(self, event_attrs):
1398 pass
1269 1399
1270 # Given a sorted sequence of type identifiers, return an appropriate type 1400 # Given a sorted sequence of type identifiers, return an appropriate type
1271 # name 1401 # name
1272 def TypeName(typeIds, interface): 1402 def TypeName(typeIds, interface):
1273 # Dynamically type this field for now. 1403 # Dynamically type this field for now.
1274 return 'var' 1404 return 'var'
1275 1405
1406 # ------------------------------------------------------------------------------
1407
1408 # TODO(jmesserly): inheritance is probably not the right way to factor this long
1409 # term, but it makes merging better for now.
1410 class HtmlDartInterfaceGenerator(DartInterfaceGenerator):
1411 """Generates Dart Interface definition for one DOM IDL interface."""
1412
1413 def __init__(self, interface, emitter, template,
1414 common_prefix, super_interface, source_filter):
1415 super(HtmlDartInterfaceGenerator, self).__init__(interface,
1416 emitter, template, common_prefix, super_interface, source_filter)
1417
1418 def AddEvents(self, event_attrs):
1419 events_interface = self._interface.id + 'Events'
1420 self._members_emitter.Emit('\n $TYPE get on();\n',
1421 TYPE=events_interface)
1422 events_members = self._emitter.Emit(
1423 '\ninterface $INTERFACE {\n$!MEMBERS}\n',
1424 INTERFACE=events_interface)
1425
1426 for getter, setter in event_attrs:
1427 event = getter or setter
1428 events_members.Emit('\n EventListenerList get $NAME();\n', NAME=event.id)
1429
1276 1430
1277 # ------------------------------------------------------------------------------ 1431 # ------------------------------------------------------------------------------
1278 1432
1279 class WrappingInterfaceGenerator(object): 1433 class WrappingInterfaceGenerator(object):
1280 """Generates Dart and JS implementation for one DOM IDL interface.""" 1434 """Generates Dart and JS implementation for one DOM IDL interface."""
1281 1435
1282 def __init__(self, interface, super_interface, dart_code, js_code, type_map, 1436 def __init__(self, interface, super_interface, dart_code, js_code, type_map,
1283 externs, base_members): 1437 externs, base_members):
1284 """Generates Dart and JS code for the given interface. 1438 """Generates Dart and JS code for the given interface.
1285 1439
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 self._externs.add((self._interface.id, attr.id, 'attribute')) 1582 self._externs.add((self._interface.id, attr.id, 'attribute'))
1429 1583
1430 def AddSecondaryAttribute(self, interface, getter, setter): 1584 def AddSecondaryAttribute(self, interface, getter, setter):
1431 self._SecondaryContext(interface) 1585 self._SecondaryContext(interface)
1432 self.AddAttribute(getter, setter) 1586 self.AddAttribute(getter, setter)
1433 1587
1434 def AddSecondaryOperation(self, interface, info): 1588 def AddSecondaryOperation(self, interface, info):
1435 self._SecondaryContext(interface) 1589 self._SecondaryContext(interface)
1436 self.AddOperation(info) 1590 self.AddOperation(info)
1437 1591
1592 def AddEvents(self, event_attrs):
1593 pass
1594
1438 def _SecondaryContext(self, interface): 1595 def _SecondaryContext(self, interface):
1439 if interface is not self._current_secondary_parent: 1596 if interface is not self._current_secondary_parent:
1440 self._current_secondary_parent = interface 1597 self._current_secondary_parent = interface
1441 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) 1598 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id)
1442 1599
1443 def AddIndexer(self, element_type): 1600 def AddIndexer(self, element_type):
1444 """Adds all the methods required to complete implementation of List.""" 1601 """Adds all the methods required to complete implementation of List."""
1445 # We would like to simply inherit the implementation of everything except 1602 # We would like to simply inherit the implementation of everything except
1446 # get length(), [], and maybe []=. It is possible to extend from a base 1603 # get length(), [], and maybe []=. It is possible to extend from a base
1447 # array implementation class only when there is no other implementation 1604 # array implementation class only when there is no other implementation
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 NAME=attr.id, TYPE=self._NarrowInputType(attr.type.id)) 2145 NAME=attr.id, TYPE=self._NarrowInputType(attr.type.id))
1989 2146
1990 def AddSecondaryAttribute(self, interface, getter, setter): 2147 def AddSecondaryAttribute(self, interface, getter, setter):
1991 self._SecondaryContext(interface) 2148 self._SecondaryContext(interface)
1992 self.AddAttribute(getter, setter) 2149 self.AddAttribute(getter, setter)
1993 2150
1994 def AddSecondaryOperation(self, interface, info): 2151 def AddSecondaryOperation(self, interface, info):
1995 self._SecondaryContext(interface) 2152 self._SecondaryContext(interface)
1996 self.AddOperation(info) 2153 self.AddOperation(info)
1997 2154
2155 def AddEvents(self, event_attrs):
2156 pass
2157
1998 def _SecondaryContext(self, interface): 2158 def _SecondaryContext(self, interface):
1999 if interface is not self._current_secondary_parent: 2159 if interface is not self._current_secondary_parent:
2000 self._current_secondary_parent = interface 2160 self._current_secondary_parent = interface
2001 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) 2161 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id)
2002 2162
2003 def AddIndexer(self, element_type): 2163 def AddIndexer(self, element_type):
2004 """Adds all the methods required to complete implementation of List.""" 2164 """Adds all the methods required to complete implementation of List."""
2005 # We would like to simply inherit the implementation of everything except 2165 # We would like to simply inherit the implementation of everything except
2006 # get length(), [], and maybe []=. It is possible to extend from a base 2166 # get length(), [], and maybe []=. It is possible to extend from a base
2007 # array implementation class only when there is no other implementation 2167 # array implementation class only when there is no other implementation
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 '\n' 2228 '\n'
2069 ' $TYPE $NAME($PARAMS) native;\n', 2229 ' $TYPE $NAME($PARAMS) native;\n',
2070 TYPE=self._NarrowOutputType(info.type_name), 2230 TYPE=self._NarrowOutputType(info.type_name),
2071 NAME=info.name, 2231 NAME=info.name,
2072 PARAMS=info.ParametersImplementationDeclaration( 2232 PARAMS=info.ParametersImplementationDeclaration(
2073 lambda type_name: self._NarrowInputType(type_name))) 2233 lambda type_name: self._NarrowInputType(type_name)))
2074 2234
2075 2235
2076 # ------------------------------------------------------------------------------ 2236 # ------------------------------------------------------------------------------
2077 2237
2238 # TODO(jmesserly): inheritance is probably not the right way to factor this long
2239 # term, but it makes merging better for now.
2240 class HtmlFrogInterfaceGenerator(FrogInterfaceGenerator):
2241 """Generates a Frog class for the dart:html library from a DOM IDL
2242 interface.
2243 """
2244
2245 def __init__(self, system, interface, template, super_interface, dart_code):
2246 super(HtmlFrogInterfaceGenerator, self).__init__(
2247 system, interface, template, super_interface, dart_code)
2248
2249 def AddEvents(self, event_attrs):
2250 events_class = self._interface.id + 'EventsImpl'
2251 events_interface = self._interface.id + 'Events'
2252 self._members_emitter.Emit('\n $TYPE get on() =>\n new $TYPE(this);\n',
sra1 2012/02/07 05:06:16 I find this kind of string easier to read if you a
Jennifer Messerly 2012/02/07 21:05:14 Done.
2253 TYPE=events_class)
2254
2255 events_members = self._dart_code.Emit(
2256 '\nclass $CLASSNAME extends EventsImplementation '
2257 'implements $INTERFACE {\n'
2258 ' $CLASSNAME(_ptr) : super._wrap(_ptr);\n$!MEMBERS}\n',
2259 CLASSNAME=events_class,
2260 INTERFACE=events_interface)
2261
2262 for getter, setter in event_attrs:
2263 event = getter or setter
2264 events_members.Emit(
2265 "\n EventListenerList get $NAME() => _get('$NAME');\n",
2266 NAME=event.id)
2267
2268
2269 # ------------------------------------------------------------------------------
2270
2078 class NativeImplementationSystem(System): 2271 class NativeImplementationSystem(System):
2079 2272
2080 def __init__(self, templates, database, emitters, auxiliary_dir, output_dir): 2273 def __init__(self, templates, database, emitters, auxiliary_dir, output_dir):
2081 super(NativeImplementationSystem, self).__init__( 2274 super(NativeImplementationSystem, self).__init__(
2082 templates, database, emitters, output_dir) 2275 templates, database, emitters, output_dir)
2083 2276
2084 self._auxiliary_dir = auxiliary_dir 2277 self._auxiliary_dir = auxiliary_dir
2085 self._dom_public_files = [] 2278 self._dom_public_files = []
2086 self._dom_impl_files = [] 2279 self._dom_impl_files = []
2087 2280
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 INDENT=indent, 2483 INDENT=indent,
2291 NATIVENAME=native_name, 2484 NATIVENAME=native_name,
2292 ARGS=argument_expressions) 2485 ARGS=argument_expressions)
2293 2486
2294 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native ' 2487 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native '
2295 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n', 2488 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n',
2296 NATIVE_NAME=native_name, 2489 NATIVE_NAME=native_name,
2297 TYPE=info.type_name, 2490 TYPE=info.type_name,
2298 PARAMS=', '.join(arg_names), 2491 PARAMS=', '.join(arg_names),
2299 INTERFACE=self._interface.id) 2492 INTERFACE=self._interface.id)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698