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

Side by Side Diff: lib/html/scripts/systemdart2js.py

Issue 10907171: Migrate scripts to new getter syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/html/scripts/css_code_generator.py ('k') | lib/html/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 shared functionality for the systems to generate 6 """This module provides shared functionality for the systems to generate
7 dart2js binding from the IDL database.""" 7 dart2js binding from the IDL database."""
8 8
9 import os 9 import os
10 from generator import * 10 from generator import *
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 def _AddAttributeUsingProperties(self, getter, setter): 249 def _AddAttributeUsingProperties(self, getter, setter):
250 if getter: 250 if getter:
251 self._AddGetter(getter) 251 self._AddGetter(getter)
252 if setter: 252 if setter:
253 self._AddSetter(setter) 253 self._AddSetter(setter)
254 254
255 def _AddGetter(self, attr): 255 def _AddGetter(self, attr):
256 # TODO(sra): Remove native body when Issue 829 fixed. 256 # TODO(sra): Remove native body when Issue 829 fixed.
257 self._members_emitter.Emit( 257 self._members_emitter.Emit(
258 '\n $(OPT_TYPE)get $NAME() native "return this.$NATIVE_NAME;";\n', 258 '\n $(OPT_TYPE)get $NAME native "return this.$NATIVE_NAME;";\n',
259 NAME=DartDomNameOfAttribute(attr), 259 NAME=DartDomNameOfAttribute(attr),
260 NATIVE_NAME=attr.id, 260 NATIVE_NAME=attr.id,
261 OPT_TYPE=TypeOrNothing(self._NarrowOutputType(attr.type.id))) 261 OPT_TYPE=TypeOrNothing(self._NarrowOutputType(attr.type.id)))
262 262
263 def _AddSetter(self, attr): 263 def _AddSetter(self, attr):
264 # TODO(sra): Remove native body when Issue 829 fixed. 264 # TODO(sra): Remove native body when Issue 829 fixed.
265 self._members_emitter.Emit( 265 self._members_emitter.Emit(
266 ' void set $NAME($(OPT_TYPE)value)' 266 ' void set $NAME($(OPT_TYPE)value)'
267 ' native "this.$NATIVE_NAME = value;";\n', 267 ' native "this.$NATIVE_NAME = value;";\n',
268 NAME=DartDomNameOfAttribute(attr), 268 NAME=DartDomNameOfAttribute(attr),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 self.AddOperation(info) 317 self.AddOperation(info)
318 318
319 def SecondaryContext(self, interface): 319 def SecondaryContext(self, interface):
320 if interface is not self._current_secondary_parent: 320 if interface is not self._current_secondary_parent:
321 self._current_secondary_parent = interface 321 self._current_secondary_parent = interface
322 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) 322 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id)
323 323
324 def AddIndexer(self, element_type): 324 def AddIndexer(self, element_type):
325 """Adds all the methods required to complete implementation of List.""" 325 """Adds all the methods required to complete implementation of List."""
326 # We would like to simply inherit the implementation of everything except 326 # We would like to simply inherit the implementation of everything except
327 # get length(), [], and maybe []=. It is possible to extend from a base 327 # length, [], and maybe []=. It is possible to extend from a base
328 # array implementation class only when there is no other implementation 328 # array implementation class only when there is no other implementation
329 # inheritance. There might be no implementation inheritance other than 329 # inheritance. There might be no implementation inheritance other than
330 # DOMBaseWrapper for many classes, but there might be some where the 330 # DOMBaseWrapper for many classes, but there might be some where the
331 # array-ness is introduced by a non-root interface: 331 # array-ness is introduced by a non-root interface:
332 # 332 #
333 # interface Y extends X, List<T> ... 333 # interface Y extends X, List<T> ...
334 # 334 #
335 # In the non-root case we have to choose between: 335 # In the non-root case we have to choose between:
336 # 336 #
337 # class YImpl extends XImpl { add List<T> methods; } 337 # class YImpl extends XImpl { add List<T> methods; }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 if info.declared_name != info.name: 377 if info.declared_name != info.name:
378 native_string = " '%s'" % info.declared_name 378 native_string = " '%s'" % info.declared_name
379 379
380 self._members_emitter.Emit( 380 self._members_emitter.Emit(
381 '\n' 381 '\n'
382 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', 382 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n',
383 TYPE=self._NarrowOutputType(info.type_name), 383 TYPE=self._NarrowOutputType(info.type_name),
384 NAME=info.name, 384 NAME=info.name,
385 PARAMS=params, 385 PARAMS=params,
386 NATIVESTRING=native_string) 386 NATIVESTRING=native_string)
OLDNEW
« no previous file with comments | « lib/html/scripts/css_code_generator.py ('k') | lib/html/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698