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

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

Issue 9312003: Use fields in hidden native DOM classes instead of getters/setters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also fix native 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
« no previous file with comments | « client/dom/generated/src/frog/XPathResult.dart ('k') | no next file » | 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 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 source_filter) 483 source_filter)
484 for system in self._systems] 484 for system in self._systems]
485 485
486 for generator in generators: 486 for generator in generators:
487 generator.StartInterface() 487 generator.StartInterface()
488 488
489 for const in sorted(interface.constants, ConstantOutputOrder): 489 for const in sorted(interface.constants, ConstantOutputOrder):
490 for generator in generators: 490 for generator in generators:
491 generator.AddConstant(const) 491 generator.AddConstant(const)
492 492
493 for attr in sorted(interface.attributes, AttributeOutputOrder): 493 attributes = [attr for attr in interface.attributes
494 if attr.type.id == 'EventListener': 494 if not self._OmitAttribute(interface, attr)]
495 # Remove EventListener attributes like 'onclick' when addEventListener 495 for (getter, setter) in _PairUpAttributes(attributes):
496 # is available. 496 for generator in generators:
497 if 'EventTarget' in self._AllImplementedInterfaces(interface): 497 generator.AddAttribute(getter, setter)
498 continue
499 if attr.is_fc_getter:
500 for generator in generators:
501 generator.AddGetter(attr)
502 elif attr.is_fc_setter:
503 for generator in generators:
504 generator.AddSetter(attr)
505 498
506 # The implementation should define an indexer if the interface directly 499 # The implementation should define an indexer if the interface directly
507 # extends List. 500 # extends List.
508 element_type = MaybeListElementType(interface) 501 element_type = MaybeListElementType(interface)
509 if element_type: 502 if element_type:
510 for generator in generators: 503 for generator in generators:
511 generator.AddIndexer(element_type) 504 generator.AddIndexer(element_type)
512 505
513 # Group overloaded operations by id 506 # Group overloaded operations by id
514 operationsById = {} 507 operationsById = {}
(...skipping 10 matching lines...) Expand all
525 generator.AddOperation(info) 518 generator.AddOperation(info)
526 519
527 # With multiple inheritance, attributes and operations of non-first 520 # With multiple inheritance, attributes and operations of non-first
528 # interfaces need to be added. Sometimes the attribute or operation is 521 # interfaces need to be added. Sometimes the attribute or operation is
529 # defined in the current interface as well as a parent. In that case we 522 # defined in the current interface as well as a parent. In that case we
530 # avoid making a duplicate definition and pray that the signatures match. 523 # avoid making a duplicate definition and pray that the signatures match.
531 524
532 for parent_interface in self._TransitiveSecondaryParents(interface): 525 for parent_interface in self._TransitiveSecondaryParents(interface):
533 if isinstance(parent_interface, str): # _IsDartCollectionType(parent_inte rface) 526 if isinstance(parent_interface, str): # _IsDartCollectionType(parent_inte rface)
534 continue 527 continue
535 attributes = sorted(parent_interface.attributes, 528 attributes = [attr for attr in parent_interface.attributes
536 AttributeOutputOrder) 529 if not self._DefinesSameAttribute(interface, attr)]
537 for attr in attributes: 530 for (getter, setter) in _PairUpAttributes(attributes):
538 if not self._DefinesSameAttribute(interface, attr): 531 for generator in generators:
539 if attr.is_fc_getter: 532 generator.AddSecondaryAttribute(parent_interface, getter, setter)
540 for generator in generators:
541 generator.AddSecondaryGetter(parent_interface, attr)
542 elif attr.is_fc_setter:
543 for generator in generators:
544 generator.AddSecondarySetter(parent_interface, attr)
545 533
546 # Group overloaded operations by id 534 # Group overloaded operations by id
547 operationsById = {} 535 operationsById = {}
548 for operation in parent_interface.operations: 536 for operation in parent_interface.operations:
549 if operation.id not in operationsById: 537 if operation.id not in operationsById:
550 operationsById[operation.id] = [] 538 operationsById[operation.id] = []
551 operationsById[operation.id].append(operation) 539 operationsById[operation.id].append(operation)
552 540
553 # Generate operations 541 # Generate operations
554 for id in sorted(operationsById.keys()): 542 for id in sorted(operationsById.keys()):
555 if not any(op.id == id for op in interface.operations): 543 if not any(op.id == id for op in interface.operations):
556 operations = operationsById[id] 544 operations = operationsById[id]
557 info = _AnalyzeOperation(interface, operations) 545 info = _AnalyzeOperation(interface, operations)
558 for generator in generators: 546 for generator in generators:
559 generator.AddSecondaryOperation(parent_interface, info) 547 generator.AddSecondaryOperation(parent_interface, info)
560 548
561 for generator in generators: 549 for generator in generators:
562 generator.FinishInterface() 550 generator.FinishInterface()
563 return 551 return
564 552
553 def _OmitAttribute(self, interface, attr):
554 # Remove EventListener attributes like 'onclick' when addEventListener
555 # is available.
556 if attr.type.id == 'EventListener':
557 if 'EventTarget' in self._AllImplementedInterfaces(interface):
558 return True
559 return False
560
565 def _DefinesSameAttribute(self, interface, attr1): 561 def _DefinesSameAttribute(self, interface, attr1):
566 return any(attr1.id == attr2.id 562 return any(attr1.id == attr2.id
567 and attr1.is_fc_getter == attr2.is_fc_getter 563 and attr1.is_fc_getter == attr2.is_fc_getter
568 and attr1.is_fc_setter == attr2.is_fc_setter 564 and attr1.is_fc_setter == attr2.is_fc_setter
569 for attr2 in interface.attributes) 565 for attr2 in interface.attributes)
570 566
571 def _TransitiveSecondaryParents(self, interface): 567 def _TransitiveSecondaryParents(self, interface):
572 """Returns a list of all non-primary parents. 568 """Returns a list of all non-primary parents.
573 569
574 The list contains the interface objects for interfaces defined in the 570 The list contains the interface objects for interfaces defined in the
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 """Returns the info for the callback method if the interface smells like a 625 """Returns the info for the callback method if the interface smells like a
630 callback. 626 callback.
631 """ 627 """
632 if 'Callback' not in interface.ext_attrs: return None 628 if 'Callback' not in interface.ext_attrs: return None
633 handlers = [op for op in interface.operations if op.id == 'handleEvent'] 629 handlers = [op for op in interface.operations if op.id == 'handleEvent']
634 if not handlers: return None 630 if not handlers: return None
635 if not (handlers == interface.operations): return None 631 if not (handlers == interface.operations): return None
636 return _AnalyzeOperation(interface, handlers) 632 return _AnalyzeOperation(interface, handlers)
637 633
638 634
635 def _PairUpAttributes(attributes):
636 """Returns a list of (getter, setter) pairs sorted by name.
637
638 One element of the pair may be None.
639 """
640 names = sorted(set(attr.id for attr in attributes))
641 getters = {}
642 setters = {}
643 for attr in attributes:
644 if attr.is_fc_getter:
645 getters[attr.id] = attr
646 elif attr.is_fc_setter:
647 setters[attr.id] = attr
648 return [(getters.get(id), setters.get(id)) for id in names]
649
650
639 def _AnalyzeOperation(interface, operations): 651 def _AnalyzeOperation(interface, operations):
640 """Makes operation calling convention decision for a set of overloads. 652 """Makes operation calling convention decision for a set of overloads.
641 653
642 Returns: An OperationInfo object. 654 Returns: An OperationInfo object.
643 """ 655 """
644 656
645 # Zip together arguments from each overload by position, then convert 657 # Zip together arguments from each overload by position, then convert
646 # to a dart argument. 658 # to a dart argument.
647 659
648 # Given a list of overloaded arguments, choose a suitable name. 660 # Given a list of overloaded arguments, choose a suitable name.
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 if (not self._super_interface or 1242 if (not self._super_interface or
1231 self._interface.id is self._super_interface): 1243 self._interface.id is self._super_interface):
1232 self._EmitConstant(self._members_emitter, constant) 1244 self._EmitConstant(self._members_emitter, constant)
1233 1245
1234 def _EmitConstant(self, emitter, constant): 1246 def _EmitConstant(self, emitter, constant):
1235 emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', 1247 emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n',
1236 NAME=constant.id, 1248 NAME=constant.id,
1237 TYPE=constant.type.id, 1249 TYPE=constant.type.id,
1238 VALUE=constant.value) 1250 VALUE=constant.value)
1239 1251
1240 def AddGetter(self, attr): 1252 def AddAttribute(self, getter, setter):
1241 self._members_emitter.Emit('\n $TYPE get $NAME();\n', 1253 if getter:
1242 NAME=attr.id, TYPE=attr.type.id) 1254 self._members_emitter.Emit('\n $TYPE get $NAME();\n',
1243 1255 NAME=getter.id, TYPE=getter.type.id)
1244 def AddSetter(self, attr): 1256 if setter:
1245 self._members_emitter.Emit('\n void set $NAME($TYPE value);\n', 1257 self._members_emitter.Emit('\n void set $NAME($TYPE value);\n',
1246 NAME=attr.id, TYPE=attr.type.id) 1258 NAME=setter.id, TYPE=setter.type.id)
1247 1259
1248 def AddIndexer(self, element_type): 1260 def AddIndexer(self, element_type):
1249 # Interface inherits all operations from List<element_type>. 1261 # Interface inherits all operations from List<element_type>.
1250 pass 1262 pass
1251 1263
1252 def AddOperation(self, info): 1264 def AddOperation(self, info):
1253 """ 1265 """
1254 Arguments: 1266 Arguments:
1255 operations - contains the overloads, one or more operations with the same 1267 operations - contains the overloads, one or more operations with the same
1256 name. 1268 name.
1257 """ 1269 """
1258 self._members_emitter.Emit('\n' 1270 self._members_emitter.Emit('\n'
1259 ' $TYPE $NAME($PARAMS);\n', 1271 ' $TYPE $NAME($PARAMS);\n',
1260 TYPE=info.type_name, 1272 TYPE=info.type_name,
1261 NAME=info.name, 1273 NAME=info.name,
1262 PARAMS=info.ParametersInterfaceDeclaration()) 1274 PARAMS=info.ParametersInterfaceDeclaration())
1263 1275
1264 # Interfaces get secondary members directly via the superinterfaces. 1276 # Interfaces get secondary members directly via the superinterfaces.
1265 def AddSecondaryGetter(self, interface, attr): 1277 def AddSecondaryAttribute(self, interface, getter, setter):
1266 pass 1278 pass
1267 def AddSecondarySetter(self, interface, attr): 1279
1268 pass
1269 def AddSecondaryOperation(self, interface, attr): 1280 def AddSecondaryOperation(self, interface, attr):
1270 pass 1281 pass
1271 1282
1272 1283
1273 # Given a sorted sequence of type identifiers, return an appropriate type 1284 # Given a sorted sequence of type identifiers, return an appropriate type
1274 # name 1285 # name
1275 def TypeName(typeIds, interface): 1286 def TypeName(typeIds, interface):
1276 # Dynamically type this field for now. 1287 # Dynamically type this field for now.
1277 return 'var' 1288 return 'var'
1278 1289
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 def AddConstant(self, constant): 1385 def AddConstant(self, constant):
1375 # Constants are already defined on the interface. 1386 # Constants are already defined on the interface.
1376 pass 1387 pass
1377 1388
1378 def _MethodName(self, prefix, name): 1389 def _MethodName(self, prefix, name):
1379 method_name = prefix + name 1390 method_name = prefix + name
1380 if name in self._base_members: # Avoid illegal Dart 'static override'. 1391 if name in self._base_members: # Avoid illegal Dart 'static override'.
1381 method_name = method_name + '_' + self._interface.id 1392 method_name = method_name + '_' + self._interface.id
1382 return method_name 1393 return method_name
1383 1394
1384 def AddGetter(self, attr): 1395 def AddAttribute(self, getter, setter):
1396 if getter:
1397 self._AddGetter(getter)
1398 if setter:
1399 self._AddSetter(setter)
1400
1401 def _AddGetter(self, attr):
1385 # FIXME: Instead of injecting the interface name into the method when it is 1402 # FIXME: Instead of injecting the interface name into the method when it is
1386 # also implemented in the base class, suppress the method altogether if it 1403 # also implemented in the base class, suppress the method altogether if it
1387 # has the same signature. I.e., let the JS do the virtual dispatch instead. 1404 # has the same signature. I.e., let the JS do the virtual dispatch instead.
1388 method_name = self._MethodName('_get_', attr.id) 1405 method_name = self._MethodName('_get_', attr.id)
1389 self._members_emitter.Emit( 1406 self._members_emitter.Emit(
1390 '\n' 1407 '\n'
1391 ' $TYPE get $NAME() { return $METHOD(this); }\n' 1408 ' $TYPE get $NAME() { return $METHOD(this); }\n'
1392 ' static $TYPE $METHOD(var _this) native;\n', 1409 ' static $TYPE $METHOD(var _this) native;\n',
1393 NAME=attr.id, TYPE=attr.type.id, METHOD=method_name) 1410 NAME=attr.id, TYPE=attr.type.id, METHOD=method_name)
1394 if (self._interface.id, attr.id) not in _custom_getters: 1411 if (self._interface.id, attr.id) not in _custom_getters:
1395 self._js_code.Emit( 1412 self._js_code.Emit(
1396 '\n' 1413 '\n'
1397 'function native_$(CLASS)_$(METHOD)(_this) {\n' 1414 'function native_$(CLASS)_$(METHOD)(_this) {\n'
1398 ' try {\n' 1415 ' try {\n'
1399 ' return __dom_wrap(_this.$dom.$NAME);\n' 1416 ' return __dom_wrap(_this.$dom.$NAME);\n'
1400 ' } catch (e) {\n' 1417 ' } catch (e) {\n'
1401 ' throw __dom_wrap_exception(e);\n' 1418 ' throw __dom_wrap_exception(e);\n'
1402 ' }\n' 1419 ' }\n'
1403 '}\n', 1420 '}\n',
1404 CLASS=self._class_name, NAME=attr.id, METHOD=method_name) 1421 CLASS=self._class_name, NAME=attr.id, METHOD=method_name)
1405 self._externs.add((self._interface.id, attr.id, 'attribute')) 1422 self._externs.add((self._interface.id, attr.id, 'attribute'))
1406 1423
1407 def AddSetter(self, attr): 1424 def _AddSetter(self, attr):
1408 # FIXME: See comment on getter. 1425 # FIXME: See comment on getter.
1409 method_name = self._MethodName('_set_', attr.id) 1426 method_name = self._MethodName('_set_', attr.id)
1410 self._members_emitter.Emit( 1427 self._members_emitter.Emit(
1411 '\n' 1428 '\n'
1412 ' void set $NAME($TYPE value) { $METHOD(this, value); }\n' 1429 ' void set $NAME($TYPE value) { $METHOD(this, value); }\n'
1413 ' static void $METHOD(var _this, $TYPE value) native;\n', 1430 ' static void $METHOD(var _this, $TYPE value) native;\n',
1414 NAME=attr.id, TYPE=attr.type.id, METHOD=method_name) 1431 NAME=attr.id, TYPE=attr.type.id, METHOD=method_name)
1415 self._js_code.Emit( 1432 self._js_code.Emit(
1416 '\n' 1433 '\n'
1417 'function native_$(CLASS)_$(METHOD)(_this, value) {\n' 1434 'function native_$(CLASS)_$(METHOD)(_this, value) {\n'
1418 ' try {\n' 1435 ' try {\n'
1419 ' _this.$dom.$NAME = __dom_unwrap(value);\n' 1436 ' _this.$dom.$NAME = __dom_unwrap(value);\n'
1420 ' } catch (e) {\n' 1437 ' } catch (e) {\n'
1421 ' throw __dom_wrap_exception(e);\n' 1438 ' throw __dom_wrap_exception(e);\n'
1422 ' }\n' 1439 ' }\n'
1423 '}\n', 1440 '}\n',
1424 CLASS=self._class_name, NAME=attr.id, METHOD=method_name) 1441 CLASS=self._class_name, NAME=attr.id, METHOD=method_name)
1425 self._externs.add((self._interface.id, attr.id, 'attribute')) 1442 self._externs.add((self._interface.id, attr.id, 'attribute'))
1426 1443
1427 def AddSecondaryGetter(self, interface, attr): 1444 def AddSecondaryAttribute(self, interface, getter, setter):
1428 self._SecondaryContext(interface) 1445 self._SecondaryContext(interface)
1429 self.AddGetter(attr) 1446 self.AddAttribute(getter, setter)
1430
1431 def AddSecondarySetter(self, interface, attr):
1432 self._SecondaryContext(interface)
1433 self.AddSetter(attr)
1434 1447
1435 def AddSecondaryOperation(self, interface, info): 1448 def AddSecondaryOperation(self, interface, info):
1436 self._SecondaryContext(interface) 1449 self._SecondaryContext(interface)
1437 self.AddOperation(info) 1450 self.AddOperation(info)
1438 1451
1439 def _SecondaryContext(self, interface): 1452 def _SecondaryContext(self, interface):
1440 if interface is not self._current_secondary_parent: 1453 if interface is not self._current_secondary_parent:
1441 self._current_secondary_parent = interface 1454 self._current_secondary_parent = interface
1442 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) 1455 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id)
1443 1456
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 # Since we are currently generating native classes without interfaces, 1970 # Since we are currently generating native classes without interfaces,
1958 # generate the constants as part of the class. This will need to go away 1971 # generate the constants as part of the class. This will need to go away
1959 # if we revert back to generating interfaces. 1972 # if we revert back to generating interfaces.
1960 self._members_emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', 1973 self._members_emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n',
1961 NAME=constant.id, 1974 NAME=constant.id,
1962 TYPE=constant.type.id, 1975 TYPE=constant.type.id,
1963 VALUE=constant.value) 1976 VALUE=constant.value)
1964 1977
1965 pass 1978 pass
1966 1979
1967 def AddGetter(self, attr): 1980 def AddAttribute(self, getter, setter):
1981 use_fields = True
1982 output_type = getter and self._NarrowOutputType(getter.type.id)
1983 input_type = setter and self._NarrowInputType(setter.type.id)
1984 if use_fields and getter and setter:
1985 if input_type == output_type:
1986 self._members_emitter.Emit(
1987 '\n $TYPE $NAME;\n',
1988 NAME=getter.id, TYPE=output_type)
1989 return
1990 if use_fields and getter and not setter:
1991 self._members_emitter.Emit(
1992 '\n final $TYPE $NAME;\n',
1993 NAME=getter.id, TYPE=output_type)
1994 return
1995 if getter:
vsm 2012/02/06 18:37:18 Do we ever fall past this?
1996 self._AddGetter(getter)
1997 if setter:
1998 self._AddSetter(setter)
1999
2000 def _AddGetter(self, attr):
1968 # TODO(sra): Remove native body when Issue 829 fixed. 2001 # TODO(sra): Remove native body when Issue 829 fixed.
1969 self._members_emitter.Emit( 2002 self._members_emitter.Emit(
1970 '\n $TYPE get $NAME() native "return this.$NAME;";\n', 2003 '\n $TYPE get $NAME() native "return this.$NAME;";\n',
1971 NAME=attr.id, TYPE=self._NarrowOutputType(attr.type.id)) 2004 NAME=attr.id, TYPE=self._NarrowOutputType(attr.type.id))
1972 2005
1973 def AddSetter(self, attr): 2006 def _AddSetter(self, attr):
1974 # TODO(sra): Remove native body when Issue 829 fixed. 2007 # TODO(sra): Remove native body when Issue 829 fixed.
1975 self._members_emitter.Emit( 2008 self._members_emitter.Emit(
1976 '\n void set $NAME($TYPE value) native "this.$NAME = value;";\n', 2009 '\n void set $NAME($TYPE value) native "this.$NAME = value;";\n',
1977 NAME=attr.id, TYPE=self._NarrowInputType(attr.type.id)) 2010 NAME=attr.id, TYPE=self._NarrowInputType(attr.type.id))
1978 2011
1979 def AddSecondaryGetter(self, interface, attr): 2012 def AddSecondaryAttribute(self, interface, getter, setter):
1980 self._SecondaryContext(interface) 2013 self._SecondaryContext(interface)
1981 self.AddGetter(attr) 2014 self.AddAttribute(getter, setter)
1982
1983 def AddSecondarySetter(self, interface, attr):
1984 self._SecondaryContext(interface)
1985 self.AddSetter(attr)
1986 2015
1987 def AddSecondaryOperation(self, interface, info): 2016 def AddSecondaryOperation(self, interface, info):
1988 self._SecondaryContext(interface) 2017 self._SecondaryContext(interface)
1989 self.AddOperation(info) 2018 self.AddOperation(info)
1990 2019
1991 def _SecondaryContext(self, interface): 2020 def _SecondaryContext(self, interface):
1992 if interface is not self._current_secondary_parent: 2021 if interface is not self._current_secondary_parent:
1993 self._current_secondary_parent = interface 2022 self._current_secondary_parent = interface
1994 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) 2023 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id)
1995 2024
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 def FinishInterface(self): 2205 def FinishInterface(self):
2177 interface = self._interface 2206 interface = self._interface
2178 interface_name = interface.id 2207 interface_name = interface.id
2179 2208
2180 base = self._BaseClassName(interface) 2209 base = self._BaseClassName(interface)
2181 self._dart_impl_emitter.Emit( 2210 self._dart_impl_emitter.Emit(
2182 self._templates.Load('dart_implementation.darttemplate'), 2211 self._templates.Load('dart_implementation.darttemplate'),
2183 CLASS=self._class_name, BASE=base, INTERFACE=interface_name, 2212 CLASS=self._class_name, BASE=base, INTERFACE=interface_name,
2184 MEMBERS=self._members_emitter.Fragments()) 2213 MEMBERS=self._members_emitter.Fragments())
2185 2214
2186 def AddGetter(self, attr): 2215 def AddAttribute(self, getter, setter):
2216 if getter:
2217 self._AddGetter(getter)
2218 if setter:
2219 self._AddSetter(setter)
2220
2221 def _AddGetter(self, attr):
2187 self._members_emitter.Emit( 2222 self._members_emitter.Emit(
2188 '\n' 2223 '\n'
2189 ' $TYPE get $NAME() native "$(INTERFACE)_$(NAME)_Getter";\n', 2224 ' $TYPE get $NAME() native "$(INTERFACE)_$(NAME)_Getter";\n',
2190 NAME=attr.id, TYPE=attr.type.id, INTERFACE=self._interface.id) 2225 NAME=attr.id, TYPE=attr.type.id, INTERFACE=self._interface.id)
2191 2226
2192 def AddSetter(self, attr): 2227 def _AddSetter(self, attr):
2193 self._members_emitter.Emit( 2228 self._members_emitter.Emit(
2194 '\n' 2229 '\n'
2195 ' void set $NAME($TYPE) native "$(INTERFACE)_$(NAME)_Setter";\n', 2230 ' void set $NAME($TYPE) native "$(INTERFACE)_$(NAME)_Setter";\n',
2196 NAME=attr.id, TYPE=attr.type.id, INTERFACE=self._interface.id) 2231 NAME=attr.id, TYPE=attr.type.id, INTERFACE=self._interface.id)
2197 2232
2198 def _HasNativeIndexGetter(self, interface): 2233 def _HasNativeIndexGetter(self, interface):
2199 return ('HasCustomIndexGetter' in interface.ext_attrs or 2234 return ('HasCustomIndexGetter' in interface.ext_attrs or
2200 'HasNumericIndexGetter' in interface.ext_attrs) 2235 'HasNumericIndexGetter' in interface.ext_attrs)
2201 2236
2202 def _EmitNativeIndexGetter(self, interface, element_type): 2237 def _EmitNativeIndexGetter(self, interface, element_type):
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 INDENT=indent, 2312 INDENT=indent,
2278 NATIVENAME=native_name, 2313 NATIVENAME=native_name,
2279 ARGS=argument_expressions) 2314 ARGS=argument_expressions)
2280 2315
2281 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native ' 2316 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native '
2282 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n', 2317 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n',
2283 NATIVE_NAME=native_name, 2318 NATIVE_NAME=native_name,
2284 TYPE=info.type_name, 2319 TYPE=info.type_name,
2285 PARAMS=', '.join(arg_names), 2320 PARAMS=', '.join(arg_names),
2286 INTERFACE=self._interface.id) 2321 INTERFACE=self._interface.id)
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/XPathResult.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698