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

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

Issue 14855011: Cleanup of DOM classname generation (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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/htmlrenamer.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 shared functionality to provide Dart metadata for 6 """This module provides shared functionality to provide Dart metadata for
7 DOM APIs. 7 DOM APIs.
8 """ 8 """
9 9
10 import copy 10 import copy
11 import json 11 import json
12 import logging 12 import logging
13 import monitored 13 import monitored
14 import os 14 import os
15 import re 15 import re
16 from generator import ConstantOutputOrder 16 from generator import ConstantOutputOrder
17 from htmlrenamer import renamed_html_members 17 from htmlrenamer import renamed_html_members, html_interface_renames
18 18
19 _logger = logging.getLogger('DartMetadata') 19 _logger = logging.getLogger('DartMetadata')
20 20
21 # Annotations to be placed on native members. The table is indexed by the IDL 21 # Annotations to be placed on native members. The table is indexed by the IDL
22 # interface and member name, and by IDL return or field type name. Both are 22 # interface and member name, and by IDL return or field type name. Both are
23 # used to assemble the annotations: 23 # used to assemble the annotations:
24 # 24 #
25 # INTERFACE.MEMBER: annotations for member. 25 # INTERFACE.MEMBER: annotations for member.
26 # +TYPE: add annotations only if there are member annotations. 26 # +TYPE: add annotations only if there are member annotations.
27 # -TYPE: add annotations only if there are no member annotations. 27 # -TYPE: add annotations only if there are no member annotations.
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 annotations = ["@DomName('" + key + "')"] 438 annotations = ["@DomName('" + key + "')"]
439 439
440 # Only add this for members, so we don't add DocsEditable to templated 440 # Only add this for members, so we don't add DocsEditable to templated
441 # classes (they get it from the default class template) 441 # classes (they get it from the default class template)
442 if member_name: 442 if member_name:
443 annotations.append('@DocsEditable'); 443 annotations.append('@DocsEditable');
444 444
445 if key in _annotations: 445 if key in _annotations:
446 annotations.extend(_annotations[key]) 446 annotations.extend(_annotations[key])
447 447
448 if (not member_name and interface_name.startswith('WebKit') and
449 interface_name not in html_interface_renames):
450 annotations.extend(_webkit_experimental_annotations)
451
448 if (member_name and member_name.startswith('webkit') and 452 if (member_name and member_name.startswith('webkit') and
449 key not in renamed_html_members): 453 key not in renamed_html_members):
450 annotations.extend(_webkit_experimental_annotations) 454 annotations.extend(_webkit_experimental_annotations)
451 455
452 if source_member_name: 456 if source_member_name:
453 member_name = source_member_name 457 member_name = source_member_name
454 458
455 # TODO(blois): Emit support level annotations 459 # TODO(blois): Emit support level annotations
456 self._GetSupportLevelAnnotation(interface_name, member_name) 460 self._GetSupportLevelAnnotation(interface_name, member_name)
457 461
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 return 563 return
560 elif support_level == 'deprecated': 564 elif support_level == 'deprecated':
561 return '@Deprecated' 565 return '@Deprecated'
562 else: 566 else:
563 _logger.warn('Unknown support_level - %s:%s' % (interface.id, member_id)) 567 _logger.warn('Unknown support_level - %s:%s' % (interface.id, member_id))
564 568
565 def Flush(self): 569 def Flush(self):
566 json_file = open(self._api_status_path, 'w+') 570 json_file = open(self._api_status_path, 'w+')
567 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key s=True) 571 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key s=True)
568 json_file.close() 572 json_file.close()
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698