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

Side by Side Diff: lib/html/scripts/generator.py

Issue 11033024: Get rid of webkit renames. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 systems to generate 6 """This module provides shared functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import copy 9 import copy
10 import re 10 import re
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 self._cache[type_name] = self._TypeInfo(type_name) 967 self._cache[type_name] = self._TypeInfo(type_name)
968 return self._cache[type_name] 968 return self._cache[type_name]
969 969
970 def DartType(self, type_name): 970 def DartType(self, type_name):
971 dart_type = self.TypeInfo(type_name).dart_type() 971 dart_type = self.TypeInfo(type_name).dart_type()
972 if self._database.HasInterface(dart_type): 972 if self._database.HasInterface(dart_type):
973 interface = self._database.GetInterface(dart_type) 973 interface = self._database.GetInterface(dart_type)
974 if self._renamer: 974 if self._renamer:
975 return self._renamer.RenameInterface(interface) 975 return self._renamer.RenameInterface(interface)
976 else: 976 else:
977 return interface.id 977 return interface.ext_attrs.get('InterfaceName', interface.id)
978 return dart_type 978 return dart_type
979 979
980 def _TypeInfo(self, type_name): 980 def _TypeInfo(self, type_name):
981 match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name) 981 match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name)
982 if match: 982 if match:
983 if type_name == 'DOMString[]': 983 if type_name == 'DOMString[]':
984 return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMSt ring')) 984 return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMSt ring'))
985 item_info = self.TypeInfo(match.group(1) or match.group(2)) 985 item_info = self.TypeInfo(match.group(1) or match.group(2))
986 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) 986 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info)
987 if not type_name in _idl_type_registry: 987 if not type_name in _idl_type_registry:
988 return InterfaceIDLTypeInfo(type_name, TypeData('Interface')) 988 return InterfaceIDLTypeInfo(type_name, TypeData('Interface'))
989 type_data = _idl_type_registry.get(type_name) 989 type_data = _idl_type_registry.get(type_name)
990 class_name = '%sIDLTypeInfo' % type_data.clazz 990 class_name = '%sIDLTypeInfo' % type_data.clazz
991 return globals()[class_name](type_name, type_data) 991 return globals()[class_name](type_name, type_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698