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

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

Issue 10785035: Properly generate MutationCallback in dart:html. (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 | « lib/dom/frog/dom_frog.dart ('k') | lib/dom/scripts/generator.py » ('j') | 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 17 matching lines...) Expand all
28 """Utilities to generate Dart APIs and corresponding JavaScript.""" 28 """Utilities to generate Dart APIs and corresponding JavaScript."""
29 29
30 def __init__(self): 30 def __init__(self):
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 IsRegisteredType(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 if type_name.endswith('[]'): 44 if type_name.endswith('[]'):
42 return self._IsCompoundType(database, type_name[:-len('[]')]) 45 return self._IsCompoundType(database, type_name[:-len('[]')])
43 46
44 striped_type_name = self._StripModules(type_name) 47 stripped_type_name = self._StripModules(type_name)
45 if database.HasInterface(striped_type_name): 48 if database.HasInterface(stripped_type_name):
46 return True 49 return True
47 50
48 dart_template_match = self._dart_templates_re.match(type_name) 51 dart_template_match = self._dart_templates_re.match(type_name)
49 if dart_template_match: 52 if dart_template_match:
50 # Dart templates 53 # Dart templates
51 parent_type_name = type_name[0 : dart_template_match.start(1) - 1] 54 parent_type_name = type_name[0 : dart_template_match.start(1) - 1]
52 sub_type_name = dart_template_match.group(1) 55 sub_type_name = dart_template_match.group(1)
53 return (self._IsCompoundType(database, parent_type_name) and 56 return (self._IsCompoundType(database, parent_type_name) and
54 self._IsCompoundType(database, sub_type_name)) 57 self._IsCompoundType(database, sub_type_name))
55 return False 58 return False
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 PARAMETERS=constructor_info.ParametersImplementationDeclaration(DartType )) 339 PARAMETERS=constructor_info.ParametersImplementationDeclaration(DartType ))
337 340
338 def FinishInterface(self): 341 def FinishInterface(self):
339 pass 342 pass
340 343
341 def AddTypedArrayConstructors(self, element_type): 344 def AddTypedArrayConstructors(self, element_type):
342 pass 345 pass
343 346
344 def AddEventAttributes(self, event_attrs): 347 def AddEventAttributes(self, event_attrs):
345 pass 348 pass
OLDNEW
« no previous file with comments | « lib/dom/frog/dom_frog.dart ('k') | lib/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698