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

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

Issue 10584031: Proper support for IDL arrays in generators. (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 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 20 matching lines...) Expand all
31 self._auxiliary_files = {} 31 self._auxiliary_files = {}
32 self._dart_templates_re = re.compile(r'[\w.:]+<([\w\.<>:]+)>') 32 self._dart_templates_re = re.compile(r'[\w.:]+<([\w\.<>:]+)>')
33 33
34 def _StripModules(self, type_name): 34 def _StripModules(self, type_name):
35 return type_name.split('::')[-1] 35 return type_name.split('::')[-1]
36 36
37 def _IsCompoundType(self, database, type_name): 37 def _IsCompoundType(self, database, type_name):
38 if IsPrimitiveType(type_name): 38 if IsPrimitiveType(type_name):
39 return True 39 return True
40 40
41 if type_name.endswith('[]'):
42 return self._IsCompoundType(database, type_name[:-len('[]')])
43
41 striped_type_name = self._StripModules(type_name) 44 striped_type_name = self._StripModules(type_name)
42 if database.HasInterface(striped_type_name): 45 if database.HasInterface(striped_type_name):
43 return True 46 return True
44 47
45 dart_template_match = self._dart_templates_re.match(type_name) 48 dart_template_match = self._dart_templates_re.match(type_name)
46 if dart_template_match: 49 if dart_template_match:
47 # Dart templates 50 # Dart templates
48 parent_type_name = type_name[0 : dart_template_match.start(1) - 1] 51 parent_type_name = type_name[0 : dart_template_match.start(1) - 1]
49 sub_type_name = dart_template_match.group(1) 52 sub_type_name = dart_template_match.group(1)
50 return (self._IsCompoundType(database, parent_type_name) and 53 return (self._IsCompoundType(database, parent_type_name) and
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 PARAMETERS=constructor_info.ParametersImplementationDeclaration()) 391 PARAMETERS=constructor_info.ParametersImplementationDeclaration())
389 392
390 def FinishInterface(self): 393 def FinishInterface(self):
391 pass 394 pass
392 395
393 def AddTypedArrayConstructors(self, element_type): 396 def AddTypedArrayConstructors(self, element_type):
394 pass 397 pass
395 398
396 def AddEventAttributes(self, event_attrs): 399 def AddEventAttributes(self, event_attrs):
397 pass 400 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698