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

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

Issue 15043005: Adding annotations to DOM constants (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/web_sql/dartium/web_sql_dartium.dart ('k') | no next file » | 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 system to generate 6 """This module provides shared functionality for the system to generate
7 dart:html APIs from the IDL database.""" 7 dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 from generator import AnalyzeOperation, ConstantOutputOrder, \ 10 from generator import AnalyzeOperation, ConstantOutputOrder, \
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 for operation in interface.operations: 124 for operation in interface.operations:
125 name = operation.ext_attrs.get('DartName', operation.id) 125 name = operation.ext_attrs.get('DartName', operation.id)
126 operationsByName.setdefault(name, []).append(operation) 126 operationsByName.setdefault(name, []).append(operation)
127 return operationsByName 127 return operationsByName
128 128
129 def AddConstant(self, constant): 129 def AddConstant(self, constant):
130 const_name = self._renamer.RenameMember( 130 const_name = self._renamer.RenameMember(
131 self._interface.id, constant, constant.id, 'get:', dartify_name=False) 131 self._interface.id, constant, constant.id, 'get:', dartify_name=False)
132 if not const_name: 132 if not const_name:
133 return 133 return
134
135 annotations = self._metadata.GetFormattedMetadata(
136 self._library_name, self._interface, constant.id, ' ')
137
134 type = TypeOrNothing(self._DartType(constant.type.id), constant.type.id) 138 type = TypeOrNothing(self._DartType(constant.type.id), constant.type.id)
135 self._members_emitter.Emit('\n static const $TYPE$NAME = $VALUE;\n', 139 self._members_emitter.Emit(
140 '\n $(ANNOTATIONS)static const $TYPE$NAME = $VALUE;\n',
141 ANNOTATIONS=annotations,
136 NAME=const_name, 142 NAME=const_name,
137 TYPE=type, 143 TYPE=type,
138 VALUE=constant.value) 144 VALUE=constant.value)
139 145
140 def AddAttribute(self, attribute, declare_only=False): 146 def AddAttribute(self, attribute, declare_only=False):
141 """ Adds an attribute to the generated class. 147 """ Adds an attribute to the generated class.
142 Arguments: 148 Arguments:
143 attribute - The attribute which is to be added. 149 attribute - The attribute which is to be added.
144 declare_only- True if the attribute should be declared as an abstract 150 declare_only- True if the attribute should be declared as an abstract
145 member and not include invocation code. 151 member and not include invocation code.
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if interface.parents: 603 if interface.parents:
598 parent = interface.parents[0] 604 parent = interface.parents[0]
599 if IsPureInterface(parent.type.id): 605 if IsPureInterface(parent.type.id):
600 walk(interface.parents) 606 walk(interface.parents)
601 else: 607 else:
602 walk(interface.parents[1:]) 608 walk(interface.parents[1:])
603 return result 609 return result
604 610
605 def _DartType(self, type_name): 611 def _DartType(self, type_name):
606 return self._type_registry.DartType(type_name) 612 return self._type_registry.DartType(type_name)
OLDNEW
« no previous file with comments | « sdk/lib/web_sql/dartium/web_sql_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698