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

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

Issue 10704238: Fix dom generation after renamer refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « no previous file | 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 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 822
823 def TypeInfo(self, type_name): 823 def TypeInfo(self, type_name):
824 if not type_name in self._cache: 824 if not type_name in self._cache:
825 self._cache[type_name] = self._TypeInfo(type_name) 825 self._cache[type_name] = self._TypeInfo(type_name)
826 return self._cache[type_name] 826 return self._cache[type_name]
827 827
828 def DartType(self, type_name): 828 def DartType(self, type_name):
829 dart_type = self.TypeInfo(type_name).dart_type() 829 dart_type = self.TypeInfo(type_name).dart_type()
830 if self._database.HasInterface(dart_type): 830 if self._database.HasInterface(dart_type):
831 interface = self._database.GetInterface(dart_type) 831 interface = self._database.GetInterface(dart_type)
832 return self._renamer.RenameInterface(interface) 832 if self._renamer:
833 return self._renamer.RenameInterface(interface)
834 else:
835 return interface.id
833 return dart_type 836 return dart_type
834 837
835 def _TypeInfo(self, type_name): 838 def _TypeInfo(self, type_name):
836 match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name) 839 match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name)
837 if match: 840 if match:
838 if type_name == 'DOMString[]': 841 if type_name == 'DOMString[]':
839 return DOMStringArrayTypeInfo(self.TypeInfo('DOMString')) 842 return DOMStringArrayTypeInfo(self.TypeInfo('DOMString'))
840 return SequenceIDLTypeInfo(type_name, self.TypeInfo(match.group(1) or matc h.group(2))) 843 return SequenceIDLTypeInfo(type_name, self.TypeInfo(match.group(1) or matc h.group(2)))
841 if not type_name in _idl_type_registry: 844 if not type_name in _idl_type_registry:
842 return InterfaceIDLTypeInfo(type_name, TypeData('Interface')) 845 return InterfaceIDLTypeInfo(type_name, TypeData('Interface'))
843 type_data = _idl_type_registry.get(type_name) 846 type_data = _idl_type_registry.get(type_name)
844 class_name = '%sIDLTypeInfo' % type_data.clazz 847 class_name = '%sIDLTypeInfo' % type_data.clazz
845 return globals()[class_name](type_name, type_data) 848 return globals()[class_name](type_name, type_data)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698