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

Side by Side Diff: lib/dom/scripts/systemnative.py

Issue 10447091: Cleanup NodeSelectors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 self._DartType(info.type_name), 735 self._DartType(info.type_name),
736 html_name or info.name, 736 html_name or info.name,
737 info.ParametersImplementationDeclaration(self._DartType)) 737 info.ParametersImplementationDeclaration(self._DartType))
738 738
739 if 'Custom' in info.overloads[0].ext_attrs: 739 if 'Custom' in info.overloads[0].ext_attrs:
740 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) 740 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
741 self._GenerateNativeBinding(info.name , argument_count, 741 self._GenerateNativeBinding(info.name , argument_count,
742 dart_declaration, 'Callback', True) 742 dart_declaration, 'Callback', True)
743 return 743 return
744 744
745 if self._interface.id == 'Document' and info.name == 'querySelector': 745 body = self._members_emitter.Emit(
746 # Document.querySelector has custom implementation in dart:html. 746 '\n'
747 # FIXME: Cleanup query selectors and remove this hack. 747 ' $DECLARATION {\n'
748 body = emitter.Emitter() 748 '$!BODY'
749 else: 749 ' }\n',
750 body = self._members_emitter.Emit( 750 DECLARATION=dart_declaration)
751 '\n'
752 ' $DECLARATION {\n'
753 '$!BODY'
754 ' }\n',
755 DECLARATION=dart_declaration)
756 751
757 self._native_version = 0 752 self._native_version = 0
758 overloads = self.CombineOverloads(info.overloads) 753 overloads = self.CombineOverloads(info.overloads)
759 fallthrough = self.GenerateDispatch(body, info, ' ', overloads) 754 fallthrough = self.GenerateDispatch(body, info, ' ', overloads)
760 if fallthrough: 755 if fallthrough:
761 body.Emit(' throw "Incorrect number or type of arguments";\n'); 756 body.Emit(' throw "Incorrect number or type of arguments";\n');
762 757
763 def CombineOverloads(self, overloads): 758 def CombineOverloads(self, overloads):
764 # Combine overloads that can be implemented by the same native method. This 759 # Combine overloads that can be implemented by the same native method. This
765 # undoes the expansion of optional arguments into multiple overloads unless 760 # undoes the expansion of optional arguments into multiple overloads unless
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 for parent in interface.parents: 1164 for parent in interface.parents:
1170 parent_name = parent.type.id 1165 parent_name = parent.type.id
1171 if not database.HasInterface(parent.type.id): 1166 if not database.HasInterface(parent.type.id):
1172 continue 1167 continue
1173 parent_interface = database.GetInterface(parent.type.id) 1168 parent_interface = database.GetInterface(parent.type.id)
1174 if callback(parent_interface): 1169 if callback(parent_interface):
1175 return parent_interface 1170 return parent_interface
1176 parent_interface = _FindParent(parent_interface, database, callback) 1171 parent_interface = _FindParent(parent_interface, database, callback)
1177 if parent_interface: 1172 if parent_interface:
1178 return parent_interface 1173 return parent_interface
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698