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

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

Issue 10541029: Do not merge IDL interfaces in dartdomgenerator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed shadowing. Created 8 years, 6 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 frog binding from the IDL database.""" 7 frog binding from the IDL database."""
8 8
9 import os 9 import os
10 from generator import * 10 from generator import *
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 def _AddSetter(self, attr): 271 def _AddSetter(self, attr):
272 # TODO(sra): Remove native body when Issue 829 fixed. 272 # TODO(sra): Remove native body when Issue 829 fixed.
273 self._members_emitter.Emit( 273 self._members_emitter.Emit(
274 ' void set $NAME($(OPT_TYPE)value)' 274 ' void set $NAME($(OPT_TYPE)value)'
275 ' native "this.$NATIVE_NAME = value;";\n', 275 ' native "this.$NATIVE_NAME = value;";\n',
276 NAME=DartDomNameOfAttribute(attr), 276 NAME=DartDomNameOfAttribute(attr),
277 NATIVE_NAME=attr.id, 277 NATIVE_NAME=attr.id,
278 OPT_TYPE=TypeOrNothing(self._NarrowInputType(attr.type.id))) 278 OPT_TYPE=TypeOrNothing(self._NarrowInputType(attr.type.id)))
279 279
280 def _FindShadowedAttribute(self, attr): 280 def _FindShadowedAttribute(self, attr, merged_interfaces={}):
281 """Returns (attribute, superinterface) or (None, None).""" 281 """Returns (attribute, superinterface) or (None, None)."""
282 def FindInParent(interface): 282 def FindInParent(interface):
283 """Returns matching attribute in parent, or None.""" 283 """Returns matching attribute in parent, or None."""
284 if interface.parents: 284 if interface.parents:
285 parent = interface.parents[0] 285 parent = interface.parents[0]
286 if IsDartCollectionType(parent.type.id): 286 if IsDartCollectionType(parent.type.id):
287 return (None, None) 287 return (None, None)
288 if IsPureInterface(parent.type.id): 288 if IsPureInterface(parent.type.id):
289 return (None, None) 289 return (None, None)
290 if self._system._database.HasInterface(parent.type.id): 290 if self._system._database.HasInterface(parent.type.id):
291 parent_interface = self._system._database.GetInterface(parent.type.id) 291 parent_interface = self._system._database.GetInterface(parent.type.id)
292 attr2 = FindMatchingAttribute(parent_interface, attr) 292 attr2 = FindMatchingAttribute(parent_interface, attr)
293 if attr2: 293 if attr2:
294 return (attr2, parent_interface) 294 return (attr2, parent_interface)
295 if parent.type.id in merged_interfaces:
296 merged_interface = self._system._database.GetInterface(
297 merged_interfaces[parent.type.id])
298 attr2 = FindMatchingAttribute(merged_interface, attr)
299 if attr2:
300 return (attr2, parent_interface)
295 return FindInParent(parent_interface) 301 return FindInParent(parent_interface)
sra1 2012/06/07 19:31:07 If parent_interface was merged into some other int
podivilov 2012/06/08 17:02:21 Fixed.
296 return (None, None) 302 return (None, None)
297 303
298 return FindInParent(self._interface) if attr else (None, None) 304 return FindInParent(self._interface) if attr else (None, None)
299 305
300 306
301 def AddSecondaryAttribute(self, interface, getter, setter): 307 def AddSecondaryAttribute(self, interface, getter, setter):
302 self._SecondaryContext(interface) 308 self._SecondaryContext(interface)
303 self.AddAttribute(getter, setter) 309 self.AddAttribute(getter, setter)
304 310
305 def AddSecondaryOperation(self, interface, info): 311 def AddSecondaryOperation(self, interface, info):
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if native_body: 378 if native_body:
373 native_string = " '''" + native_body + "'''" 379 native_string = " '''" + native_body + "'''"
374 380
375 self._members_emitter.Emit( 381 self._members_emitter.Emit(
376 '\n' 382 '\n'
377 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', 383 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n',
378 TYPE=self._NarrowOutputType(info.type_name), 384 TYPE=self._NarrowOutputType(info.type_name),
379 NAME=info.name, 385 NAME=info.name,
380 PARAMS=params, 386 PARAMS=params,
381 NATIVESTRING=native_string) 387 NATIVESTRING=native_string)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698