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

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

Issue 10704100: Do not split attributes on getters and setters in databasebuilder. (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/systemhtml.py ('k') | lib/dom/scripts/systemnative.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 providesfunctionality for systems to generate 6 """This module providesfunctionality for systems to generate
7 Dart interfaces from the IDL database.""" 7 Dart interfaces from the IDL database."""
8 8
9 import os 9 import os
10 import systembase 10 import systembase
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 self._interface.id is self._super_interface): 163 self._interface.id is self._super_interface):
164 self._EmitConstant(self._members_emitter, constant) 164 self._EmitConstant(self._members_emitter, constant)
165 165
166 def _EmitConstant(self, emitter, constant): 166 def _EmitConstant(self, emitter, constant):
167 emitter.Emit('\n static final $TYPE$NAME = $VALUE;\n', 167 emitter.Emit('\n static final $TYPE$NAME = $VALUE;\n',
168 NAME=constant.id, 168 NAME=constant.id,
169 TYPE=TypeOrNothing(DartType(constant.type.id), 169 TYPE=TypeOrNothing(DartType(constant.type.id),
170 constant.type.id), 170 constant.type.id),
171 VALUE=constant.value) 171 VALUE=constant.value)
172 172
173 def AddAttribute(self, getter, setter): 173 def AddAttribute(self, attribute):
174 getter = attribute
175 setter = attribute if not systembase.IsReadOnly(attribute) else None
174 if getter and setter and getter.type.id == setter.type.id: 176 if getter and setter and getter.type.id == setter.type.id:
175 self._members_emitter.Emit('\n $TYPE $NAME;\n', 177 self._members_emitter.Emit('\n $TYPE $NAME;\n',
176 NAME=DartDomNameOfAttribute(getter), 178 NAME=DartDomNameOfAttribute(getter),
177 TYPE=TypeOrVar(DartType(getter.type.id), 179 TYPE=TypeOrVar(DartType(getter.type.id),
178 getter.type.id)) 180 getter.type.id))
179 return 181 return
180 if getter and not setter: 182 if getter and not setter:
181 self._members_emitter.Emit('\n final $TYPE$NAME;\n', 183 self._members_emitter.Emit('\n final $TYPE$NAME;\n',
182 NAME=DartDomNameOfAttribute(getter), 184 NAME=DartDomNameOfAttribute(getter),
183 TYPE=TypeOrNothing(DartType(getter.type.id), 185 TYPE=TypeOrNothing(DartType(getter.type.id),
184 getter.type.id)) 186 getter.type.id))
185 return 187 return
186 raise Exception('Unexpected getter/setter combination %s %s' % 188 raise Exception('Unexpected getter/setter combination %s %s' %
187 (getter, setter)) 189 (getter, setter))
188 190
189 def AddOperation(self, info): 191 def AddOperation(self, info):
190 """ 192 """
191 Arguments: 193 Arguments:
192 operations - contains the overloads, one or more operations with the same 194 operations - contains the overloads, one or more operations with the same
193 name. 195 name.
194 """ 196 """
195 self._members_emitter.Emit('\n' 197 self._members_emitter.Emit('\n'
196 ' $TYPE $NAME($PARAMS);\n', 198 ' $TYPE $NAME($PARAMS);\n',
197 TYPE=info.type_name, 199 TYPE=info.type_name,
198 NAME=info.name, 200 NAME=info.name,
199 PARAMS=info.ParametersInterfaceDeclaration()) 201 PARAMS=info.ParametersInterfaceDeclaration())
OLDNEW
« no previous file with comments | « lib/dom/scripts/systemhtml.py ('k') | lib/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698