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

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

Issue 10789010: Do not treat callbacks with no handlers as interfaces. (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/scripts/generator.py ('k') | lib/html/dartium/html_dartium.dart » ('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 provides shared functionality for the systems to generate 6 """This module provides shared functionality for the systems to generate
7 frog binding from the IDL database.""" 7 frog binding from the IDL database."""
8 8
9 import os 9 import os
10 from generator import * 10 from generator import *
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ARGUMENTS=constructor_info.ParametersAsArgumentList()) 153 ARGUMENTS=constructor_info.ParametersAsArgumentList())
154 154
155 def _ShouldNarrowToImplementationType(self, type_name): 155 def _ShouldNarrowToImplementationType(self, type_name):
156 # TODO(sra): Move into the 'system' and cache the result. 156 # TODO(sra): Move into the 'system' and cache the result.
157 do_not_narrow = ['DOMStringList', 'DOMStringMap', 'EventListener', 157 do_not_narrow = ['DOMStringList', 'DOMStringMap', 'EventListener',
158 'IDBAny', 'IDBKey', 'MediaQueryListListener'] 158 'IDBAny', 'IDBKey', 'MediaQueryListListener']
159 if type_name in do_not_narrow: 159 if type_name in do_not_narrow:
160 return False 160 return False
161 if self._system._database.HasInterface(type_name): 161 if self._system._database.HasInterface(type_name):
162 interface = self._system._database.GetInterface(type_name) 162 interface = self._system._database.GetInterface(type_name)
163 if RecognizeCallback(interface): 163 # Callbacks are typedef functions so don't have a class.
164 # Callbacks are typedef functions so don't have a class. 164 return 'Callback' not in interface.ext_attrs
165 return False
166 return True
167 return False 165 return False
168 166
169 def _NarrowToImplementationType(self, type_name): 167 def _NarrowToImplementationType(self, type_name):
170 if self._ShouldNarrowToImplementationType(type_name): 168 if self._ShouldNarrowToImplementationType(type_name):
171 return self._ImplClassName(self._DartType(type_name)) 169 return self._ImplClassName(self._DartType(type_name))
172 return self._DartType(type_name) 170 return self._DartType(type_name)
173 171
174 def _NarrowInputType(self, type_name): 172 def _NarrowInputType(self, type_name):
175 return self._NarrowToImplementationType(type_name) 173 return self._NarrowToImplementationType(type_name)
176 174
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if native_body: 382 if native_body:
385 native_string = " '''" + native_body + "'''" 383 native_string = " '''" + native_body + "'''"
386 384
387 self._members_emitter.Emit( 385 self._members_emitter.Emit(
388 '\n' 386 '\n'
389 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', 387 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n',
390 TYPE=self._NarrowOutputType(info.type_name), 388 TYPE=self._NarrowOutputType(info.type_name),
391 NAME=info.name, 389 NAME=info.name,
392 PARAMS=params, 390 PARAMS=params,
393 NATIVESTRING=native_string) 391 NATIVESTRING=native_string)
OLDNEW
« no previous file with comments | « lib/dom/scripts/generator.py ('k') | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698