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

Side by Side Diff: sdk/lib/html/scripts/systemnative.py

Issue 11413053: Remove _NodeListWrapper, make NodeList less special. (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
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 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 else: 385 else:
386 self._members_emitter.Emit( 386 self._members_emitter.Emit(
387 '\n' 387 '\n'
388 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' , 388 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' ,
389 TYPE=self.SecureOutputType(element_type), 389 TYPE=self.SecureOutputType(element_type),
390 INTERFACE=self._interface.id) 390 INTERFACE=self._interface.id)
391 391
392 if self._HasNativeIndexSetter(): 392 if self._HasNativeIndexSetter():
393 self._EmitNativeIndexSetter(dart_element_type) 393 self._EmitNativeIndexSetter(dart_element_type)
394 else: 394 else:
395 # The HTML library implementation of NodeList has a custom indexed setter 395 self._members_emitter.Emit(
396 # implementation that uses the parent node the NodeList is associated 396 '\n'
397 # with if one is available. 397 ' void operator[]=(int index, $TYPE value) {\n'
398 if self._interface.id != 'NodeList': 398 ' throw new UnsupportedError("Cannot assign element of immutable Li st.");\n'
399 self._members_emitter.Emit( 399 ' }\n',
400 '\n' 400 TYPE=dart_element_type)
401 ' void operator[]=(int index, $TYPE value) {\n'
402 ' throw new UnsupportedError("Cannot assign element of immutable List.");\n'
403 ' }\n',
404 TYPE=dart_element_type)
405
406 # The list interface for this class is manually generated.
407 if self._interface.id == 'NodeList':
408 return
409 401
410 # TODO(sra): Use separate mixins for mutable implementations of List<T>. 402 # TODO(sra): Use separate mixins for mutable implementations of List<T>.
411 # TODO(sra): Use separate mixins for typed array implementations of List<T>. 403 # TODO(sra): Use separate mixins for typed array implementations of List<T>.
412 template_file = 'immutable_list_mixin.darttemplate' 404 template_file = 'immutable_list_mixin.darttemplate'
413 has_contains = any(op.id == 'contains' for op in self._interface.operations) 405 has_contains = any(op.id == 'contains' for op in self._interface.operations)
414 template = self._template_loader.Load( 406 template = self._template_loader.Load(
415 template_file, 407 template_file,
416 {'DEFINE_CONTAINS': not has_contains}) 408 {'DEFINE_CONTAINS': not has_contains})
417 self._members_emitter.Emit(template, E=dart_element_type) 409 self._members_emitter.Emit(template, E=dart_element_type)
418 410
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 def EmitResolver(self, template, output_dir): 881 def EmitResolver(self, template, output_dir):
890 file_path = os.path.join(output_dir, 'DartResolver.cpp') 882 file_path = os.path.join(output_dir, 'DartResolver.cpp')
891 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) 883 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template)
892 for header_file in self._headers_list: 884 for header_file in self._headers_list:
893 path = os.path.relpath(header_file, output_dir) 885 path = os.path.relpath(header_file, output_dir)
894 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 886 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
895 body_emitter.Emit( 887 body_emitter.Emit(
896 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' 888 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n'
897 ' return func;\n', 889 ' return func;\n',
898 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 890 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698