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

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

Issue 11055009: Converting NodeList to List<Node>. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 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 10
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 self._class_name = self._ImplClassName(self._html_interface_name) 493 self._class_name = self._ImplClassName(self._html_interface_name)
494 494
495 base = None 495 base = None
496 if interface.parents: 496 if interface.parents:
497 supertype = interface.parents[0].type.id 497 supertype = interface.parents[0].type.id
498 if IsDartCollectionType(supertype): 498 if IsDartCollectionType(supertype):
499 # List methods are injected in AddIndexer. 499 # List methods are injected in AddIndexer.
500 pass 500 pass
501 elif IsPureInterface(supertype): 501 elif IsPureInterface(supertype):
502 pass 502 pass
503 elif supertype == 'NodeList':
504 # Special case as NodeList gets converted to List<Node>.
Emily Fortuna 2012/10/03 00:46:21 These lines shouldn't be necessary. You added Node
505 base = '_NodeListImpl'
503 else: 506 else:
504 base = self._ImplClassName(self._DartType(supertype)) 507 base = self._ImplClassName(self._DartType(supertype))
505 508
506 native_spec = MakeNativeSpec(interface.javascript_binding_name) 509 native_spec = MakeNativeSpec(interface.javascript_binding_name)
507 510
508 extends = ' extends ' + base if base else '' 511 extends = ' extends ' + base if base else ''
509 512
510 # TODO: Include all implemented interfaces, including other Lists. 513 # TODO: Include all implemented interfaces, including other Lists.
511 implements = [self._html_interface_name] 514 implements = [self._html_interface_name]
512 element_type = MaybeTypedArrayElementType(self._interface) 515 element_type = MaybeTypedArrayElementType(self._interface)
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 def _HasJavaScriptIndexingBehaviour(self): 936 def _HasJavaScriptIndexingBehaviour(self):
934 """Returns True if the native object has an indexer and length property.""" 937 """Returns True if the native object has an indexer and length property."""
935 (element_type, requires_indexer) = ListImplementationInfo( 938 (element_type, requires_indexer) = ListImplementationInfo(
936 self._interface, self._database) 939 self._interface, self._database)
937 if element_type and requires_indexer: return True 940 if element_type and requires_indexer: return True
938 return False 941 return False
939 942
940 def _ShouldNarrowToImplementationType(self, type_name): 943 def _ShouldNarrowToImplementationType(self, type_name):
941 # TODO(sra): Move into the 'system' and cache the result. 944 # TODO(sra): Move into the 'system' and cache the result.
942 do_not_narrow = ['DOMStringList', 'DOMStringMap', 'EventListener', 945 do_not_narrow = ['DOMStringList', 'DOMStringMap', 'EventListener',
943 'IDBAny', 'IDBKey', 'MediaQueryListListener'] 946 'IDBAny', 'IDBKey', 'MediaQueryListListener', 'List<Node>',
947 'NodeList']
944 if type_name in do_not_narrow: 948 if type_name in do_not_narrow:
945 return False 949 return False
946 if self._database.HasInterface(type_name): 950 if self._database.HasInterface(type_name):
947 interface = self._database.GetInterface(type_name) 951 interface = self._database.GetInterface(type_name)
948 # Callbacks are typedef functions so don't have a class. 952 # Callbacks are typedef functions so don't have a class.
949 return 'Callback' not in interface.ext_attrs 953 return 'Callback' not in interface.ext_attrs
950 return False 954 return False
951 955
952 def _NarrowToImplementationType(self, type_name): 956 def _NarrowToImplementationType(self, type_name):
953 if self._ShouldNarrowToImplementationType(type_name): 957 if self._ShouldNarrowToImplementationType(type_name):
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 1027
1024 library_emitter = self._multiemitter.FileEmitter(library_file_path) 1028 library_emitter = self._multiemitter.FileEmitter(library_file_path)
1025 library_file_dir = os.path.dirname(library_file_path) 1029 library_file_dir = os.path.dirname(library_file_path)
1026 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) 1030 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir)
1027 imports_emitter = library_emitter.Emit( 1031 imports_emitter = library_emitter.Emit(
1028 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) 1032 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir))
1029 for path in sorted(self._path_to_emitter.keys()): 1033 for path in sorted(self._path_to_emitter.keys()):
1030 relpath = os.path.relpath(path, library_file_dir) 1034 relpath = os.path.relpath(path, library_file_dir)
1031 imports_emitter.Emit( 1035 imports_emitter.Emit(
1032 "#source('$PATH');\n", PATH=massage_path(relpath)) 1036 "#source('$PATH');\n", PATH=massage_path(relpath))
OLDNEW
« no previous file with comments | « lib/html/scripts/generator.py ('k') | lib/html/templates/html/impl/impl_DocumentFragment.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698