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

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

Issue 10700006: Make per-interface generators an implementation detail of a system. (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
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 def MakeNativeSpec(javascript_binding_name): 154 def MakeNativeSpec(javascript_binding_name):
155 if javascript_binding_name in _frog_dom_custom_native_specs: 155 if javascript_binding_name in _frog_dom_custom_native_specs:
156 return _frog_dom_custom_native_specs[javascript_binding_name] 156 return _frog_dom_custom_native_specs[javascript_binding_name]
157 else: 157 else:
158 # Make the class 'hidden' so it is dynamically patched at runtime. This 158 # Make the class 'hidden' so it is dynamically patched at runtime. This
159 # is useful not only for browser compat, but to allow code that links 159 # is useful not only for browser compat, but to allow code that links
160 # against dart:dom_deprecated to load in a worker isolate. 160 # against dart:dom_deprecated to load in a worker isolate.
161 return '*' + javascript_binding_name 161 return '*' + javascript_binding_name
162 162
163 163
164 def MatchSourceFilter(filter, thing): 164 def MatchSourceFilter(thing):
165 if not filter: 165 filter = ['WebKit', 'Dart']
166 return True 166 return any(token in thing.annotations for token in filter)
Anton Muhin 2012/06/27 18:13:55 nit: as you hard code filter, code in this method
podivilov 2012/06/27 18:48:07 Done.
167 else:
168 return any(token in thing.annotations for token in filter)
169 167
170 168
171 def DartType(idl_type_name): 169 def DartType(idl_type_name):
172 return GetIDLTypeInfo(idl_type_name).dart_type() 170 return GetIDLTypeInfo(idl_type_name).dart_type()
173 171
174 172
175 class ParamInfo(object): 173 class ParamInfo(object):
176 """Holder for various information about a parameter of a Dart operation. 174 """Holder for various information about a parameter of a Dart operation.
177 175
178 Attributes: 176 Attributes:
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 837
840 match = re.match(r'sequence<(\w+)>$', idl_type_name) 838 match = re.match(r'sequence<(\w+)>$', idl_type_name)
841 if match: 839 if match:
842 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) 840 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1)))
843 841
844 match = re.match(r'(\w+)\[\]$', idl_type_name) 842 match = re.match(r'(\w+)\[\]$', idl_type_name)
845 if match: 843 if match:
846 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) 844 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1)))
847 845
848 return IDLTypeInfo(idl_type_name) 846 return IDLTypeInfo(idl_type_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698