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

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

Issue 14651019: Changing metadata lookup to always use interface.id (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/systemhtml.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 provides functionality to generate dart:html event classes.""" 6 """This module provides functionality to generate dart:html event classes."""
7 7
8 import logging 8 import logging
9 import monitored 9 import monitored
10 10
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 for event_info in events: 230 for event_info in events:
231 (dom_name, html_name, event_type) = event_info 231 (dom_name, html_name, event_type) = event_info
232 annotation_name = dom_name + 'Event' 232 annotation_name = dom_name + 'Event'
233 233
234 # If we're using a different provider, then don't declare one. 234 # If we're using a different provider, then don't declare one.
235 if self._GetEventRedirection(interface, html_name, event_type): 235 if self._GetEventRedirection(interface, html_name, event_type):
236 continue 236 continue
237 237
238 annotations = self._metadata.FormatMetadata( 238 annotations = self._metadata.FormatMetadata(
239 self._metadata.GetMetadata(library_name, interface.id, 239 self._metadata.GetMetadata(library_name, interface,
240 annotation_name, 'on' + dom_name), ' ') 240 annotation_name, 'on' + dom_name), ' ')
241 241
242 members_emitter.Emit( 242 members_emitter.Emit(
243 "\n" 243 "\n"
244 " $(ANNOTATIONS)static const EventStreamProvider<$TYPE> " 244 " $(ANNOTATIONS)static const EventStreamProvider<$TYPE> "
245 "$(NAME)Event = const EventStreamProvider<$TYPE>('$DOM_NAME');\n", 245 "$(NAME)Event = const EventStreamProvider<$TYPE>('$DOM_NAME');\n",
246 ANNOTATIONS=annotations, 246 ANNOTATIONS=annotations,
247 NAME=html_name, 247 NAME=html_name,
248 DOM_NAME=dom_name, 248 DOM_NAME=dom_name,
249 TYPE=event_type) 249 TYPE=event_type)
(...skipping 10 matching lines...) Expand all
260 annotation_name = 'on' + dom_name 260 annotation_name = 'on' + dom_name
261 261
262 # If the provider is declared elsewhere, point to that. 262 # If the provider is declared elsewhere, point to that.
263 redirection = self._GetEventRedirection(interface, html_name, event_type) 263 redirection = self._GetEventRedirection(interface, html_name, event_type)
264 if redirection: 264 if redirection:
265 provider = '%s.%sEvent' % (redirection, html_name) 265 provider = '%s.%sEvent' % (redirection, html_name)
266 else: 266 else:
267 provider = html_name + 'Event' 267 provider = html_name + 'Event'
268 268
269 annotations = self._metadata.GetFormattedMetadata( 269 annotations = self._metadata.GetFormattedMetadata(
270 library_name, interface.id, annotation_name, ' ') 270 library_name, interface, annotation_name, ' ')
271 271
272 members_emitter.Emit( 272 members_emitter.Emit(
273 "\n" 273 "\n"
274 " $(ANNOTATIONS)Stream<$TYPE> get $(NAME) => " 274 " $(ANNOTATIONS)Stream<$TYPE> get $(NAME) => "
275 "$PROVIDER.forTarget(this);\n", 275 "$PROVIDER.forTarget(this);\n",
276 ANNOTATIONS=annotations, 276 ANNOTATIONS=annotations,
277 NAME=getter_name, 277 NAME=getter_name,
278 PROVIDER=provider, 278 PROVIDER=provider,
279 TYPE=event_type) 279 TYPE=event_type)
280 280
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 """ 348 """
349 key = '%s.%s' % (html_interface_name, dom_event_name) 349 key = '%s.%s' % (html_interface_name, dom_event_name)
350 if key in _html_event_types: 350 if key in _html_event_types:
351 return _html_event_types[key] 351 return _html_event_types[key]
352 key = '*.%s' % dom_event_name 352 key = '*.%s' % dom_event_name
353 if key in _html_event_types: 353 if key in _html_event_types:
354 return _html_event_types[key] 354 return _html_event_types[key]
355 _logger.warn('Cannot resolve event type for %s.%s' % 355 _logger.warn('Cannot resolve event type for %s.%s' %
356 (html_interface_name, dom_event_name)) 356 (html_interface_name, dom_event_name))
357 return None 357 return None
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698