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/html/scripts/systemhtml.py

Issue 11340013: Do not add secondary interfaces implemented by parents. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/dartium/html_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 import os 10 import os
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 def _TransitiveSecondaryParents(self, interface): 549 def _TransitiveSecondaryParents(self, interface):
550 """Returns a list of all non-primary parents. 550 """Returns a list of all non-primary parents.
551 551
552 The list contains the interface objects for interfaces defined in the 552 The list contains the interface objects for interfaces defined in the
553 database, and the name for undefined interfaces. 553 database, and the name for undefined interfaces.
554 """ 554 """
555 def walk(parents): 555 def walk(parents):
556 for parent in parents: 556 for parent in parents:
557 if IsDartCollectionType(parent.type.id): 557 if IsDartCollectionType(parent.type.id):
558 result.append(parent.type.id) 558 result.add(parent.type.id)
559 continue 559 continue
560 if self._database.HasInterface(parent.type.id): 560 if self._database.HasInterface(parent.type.id):
561 parent_interface = self._database.GetInterface(parent.type.id) 561 parent_interface = self._database.GetInterface(parent.type.id)
562 result.append(parent_interface) 562 result.add(parent_interface)
563 walk(parent_interface.parents) 563 walk(parent_interface.parents)
564 564
565 result = [] 565 result = set()
566 if interface.parents: 566 if interface.parents:
567 parent = interface.parents[0] 567 parent = interface.parents[0]
568 if IsPureInterface(parent.type.id): 568 if IsPureInterface(parent.type.id):
569 walk(interface.parents) 569 walk(interface.parents)
570 else: 570 else:
571 walk(interface.parents[1:]) 571 walk(interface.parents[1:])
572 while self._database.HasInterface(parent.type.id):
podivilov 2012/10/30 13:43:49 EventTarget is an extended attribute in idls, not
Anton Muhin 2012/10/30 13:45:09 I am not sure it's a hack. And even though curren
podivilov 2012/10/30 13:55:42 It's a hack because we agreed that IDL AST should
Anton Muhin 2012/10/30 14:05:01 WebKit IDLs has many peculiarities, for example, a
podivilov 2012/10/30 14:12:15 I think the rule of thumb is we shouldn't be more
573 parent_interface = self._database.GetInterface(parent.type.id)
574 result.discard(parent_interface)
575 result -= self._TransitiveSecondaryParents(parent_interface)
576 if not parent_interface.parents:
577 break
578 parent = parent_interface.parents[0]
579
572 return result 580 return result
573 581
582
574 def _DartType(self, type_name): 583 def _DartType(self, type_name):
575 return self._type_registry.DartType(type_name) 584 return self._type_registry.DartType(type_name)
576 585
577 def _IsPrivate(self, name): 586 def _IsPrivate(self, name):
578 return name.startswith('_') 587 return name.startswith('_')
579 588
580 589
581 class HtmlGeneratorDummyBackend(object): 590 class HtmlGeneratorDummyBackend(object):
582 def AddAttribute(self, attribute, html_name, read_only): 591 def AddAttribute(self, attribute, html_name, read_only):
583 pass 592 pass
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 1125
1117 library_emitter = self._multiemitter.FileEmitter(library_file_path) 1126 library_emitter = self._multiemitter.FileEmitter(library_file_path)
1118 library_file_dir = os.path.dirname(library_file_path) 1127 library_file_dir = os.path.dirname(library_file_path)
1119 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) 1128 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir)
1120 imports_emitter = library_emitter.Emit( 1129 imports_emitter = library_emitter.Emit(
1121 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) 1130 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir))
1122 for path in sorted(self._path_to_emitter.keys()): 1131 for path in sorted(self._path_to_emitter.keys()):
1123 relpath = os.path.relpath(path, library_file_dir) 1132 relpath = os.path.relpath(path, library_file_dir)
1124 imports_emitter.Emit( 1133 imports_emitter.Emit(
1125 "part '$PATH';\n", PATH=massage_path(relpath)) 1134 "part '$PATH';\n", PATH=massage_path(relpath))
OLDNEW
« no previous file with comments | « lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698