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

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

Issue 1682783002: Dartium 45 roll (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: removed htmlcommon Created 4 years, 10 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
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._dart_templates_re = re.compile(r'[\w.:]+<([\w \.<>:]+)>') 31 self._dart_templates_re = re.compile(r'[\w.:]+<([\w \.<>:]+)>')
32 _logger.setLevel(logging_level) 32 _logger.setLevel(logging_level)
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 IsRegisteredType(type_name): 38 if IsRegisteredType(type_name):
39 return True 39 return True
40 40
41 # References a typedef - normally a union type.
42 if database.HasTypeDef(type_name):
43 return True
44
41 if type_name.endswith('?'): 45 if type_name.endswith('?'):
42 return self._IsCompoundType(database, type_name[:-len('?')]) 46 return self._IsCompoundType(database, type_name[:-len('?')])
43 47
44 if type_name.endswith('[]'): 48 if type_name.endswith('[]'):
45 return self._IsCompoundType(database, type_name[:-len('[]')]) 49 return self._IsCompoundType(database, type_name[:-len('[]')])
46 50
47 stripped_type_name = self._StripModules(type_name) 51 stripped_type_name = self._StripModules(type_name)
48 if (database.HasInterface(stripped_type_name) or 52 if (database.HasInterface(stripped_type_name) or
49 database.HasDictionary(stripped_type_name)): 53 database.HasDictionary(stripped_type_name)):
50 return True 54 return True
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 call_with = operation.ext_attrs.get('CallWith', []) 237 call_with = operation.ext_attrs.get('CallWith', [])
234 if not(isinstance(call_with, list)): 238 if not(isinstance(call_with, list)):
235 call_with = [call_with] 239 call_with = [call_with]
236 constructor_with = operation.ext_attrs.get('ConstructorCallWith', []) 240 constructor_with = operation.ext_attrs.get('ConstructorCallWith', [])
237 if not(isinstance(constructor_with, list)): 241 if not(isinstance(constructor_with, list)):
238 constructor_with = [constructor_with] 242 constructor_with = [constructor_with]
239 call_with = call_with + constructor_with 243 call_with = call_with + constructor_with
240 244
241 if 'ScriptArguments' in call_with: 245 if 'ScriptArguments' in call_with:
242 operation.arguments.append(ARG) 246 operation.arguments.append(ARG)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698