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

Side by Side Diff: client/dom/scripts/systemwrapping.py

Issue 9695015: Provide DartDomNameOfAttribute (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix native Created 8 years, 9 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
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 wrapping binding from the IDL database.""" 7 wrapping binding from the IDL database."""
8 8
9 import os 9 import os
10 from generator import * 10 from generator import *
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 def _AddGetter(self, attr): 165 def _AddGetter(self, attr):
166 # FIXME: Instead of injecting the interface name into the method when it is 166 # FIXME: Instead of injecting the interface name into the method when it is
167 # also implemented in the base class, suppress the method altogether if it 167 # also implemented in the base class, suppress the method altogether if it
168 # has the same signature. I.e., let the JS do the virtual dispatch instead. 168 # has the same signature. I.e., let the JS do the virtual dispatch instead.
169 method_name = self._MethodName('_get_', attr.id) 169 method_name = self._MethodName('_get_', attr.id)
170 self._members_emitter.Emit( 170 self._members_emitter.Emit(
171 '\n' 171 '\n'
172 ' $TYPE get $NAME() { return $METHOD(this); }\n' 172 ' $TYPE get $NAME() { return $METHOD(this); }\n'
173 ' static $TYPE $METHOD(var _this) native;\n', 173 ' static $TYPE $METHOD(var _this) native;\n',
174 NAME=attr.id, TYPE=DartType(attr.type.id), METHOD=method_name) 174 NAME=DartDomNameOfAttribute(attr),
175 TYPE=DartType(attr.type.id),
176 METHOD=method_name)
175 177
176 def _AddSetter(self, attr): 178 def _AddSetter(self, attr):
177 # FIXME: See comment on getter. 179 # FIXME: See comment on getter.
178 method_name = self._MethodName('_set_', attr.id) 180 method_name = self._MethodName('_set_', attr.id)
179 self._members_emitter.Emit( 181 self._members_emitter.Emit(
180 '\n' 182 '\n'
181 ' void set $NAME($TYPE value) { $METHOD(this, value); }\n' 183 ' void set $NAME($TYPE value) { $METHOD(this, value); }\n'
182 ' static void $METHOD(var _this, $TYPE value) native;\n', 184 ' static void $METHOD(var _this, $TYPE value) native;\n',
183 NAME=attr.id, TYPE=DartType(attr.type.id), METHOD=method_name) 185 NAME=DartDomNameOfAttribute(attr),
186 TYPE=DartType(attr.type.id),
187 METHOD=method_name)
184 188
185 def AddSecondaryAttribute(self, interface, getter, setter): 189 def AddSecondaryAttribute(self, interface, getter, setter):
186 self._SecondaryContext(interface) 190 self._SecondaryContext(interface)
187 self.AddAttribute(getter, setter) 191 self.AddAttribute(getter, setter)
188 192
189 def AddSecondaryOperation(self, interface, info): 193 def AddSecondaryOperation(self, interface, info):
190 self._SecondaryContext(interface) 194 self._SecondaryContext(interface)
191 self.AddOperation(info) 195 self.AddOperation(info)
192 196
193 def _SecondaryContext(self, interface): 197 def _SecondaryContext(self, interface):
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee 534 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee
531 # that Y = Z-X, so we need to check for Y. 535 # that Y = Z-X, so we need to check for Y.
532 true_code = emitter.Emit( 536 true_code = emitter.Emit(
533 '$(INDENT)if ($COND) {\n' 537 '$(INDENT)if ($COND) {\n'
534 '$!TRUE' 538 '$!TRUE'
535 '$(INDENT)}\n', 539 '$(INDENT)}\n',
536 COND=test, INDENT=indent) 540 COND=test, INDENT=indent)
537 self.GenerateDispatch( 541 self.GenerateDispatch(
538 true_code, info, indent + ' ', position + 1, positive) 542 true_code, info, indent + ' ', position + 1, positive)
539 return True 543 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698