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

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

Issue 11187063: Generate contains() method for list mixin only if not already defined. (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
« no previous file with comments | « lib/html/scripts/systemhtml.py ('k') | lib/html/scripts/templateloader.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 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ' }\n', 391 ' }\n',
392 TYPE=dart_element_type) 392 TYPE=dart_element_type)
393 393
394 # The list interface for this class is manually generated. 394 # The list interface for this class is manually generated.
395 if self._interface.id == 'NodeList': 395 if self._interface.id == 'NodeList':
396 return 396 return
397 397
398 # TODO(sra): Use separate mixins for mutable implementations of List<T>. 398 # TODO(sra): Use separate mixins for mutable implementations of List<T>.
399 # TODO(sra): Use separate mixins for typed array implementations of List<T>. 399 # TODO(sra): Use separate mixins for typed array implementations of List<T>.
400 template_file = 'immutable_list_mixin.darttemplate' 400 template_file = 'immutable_list_mixin.darttemplate'
401 template = self._template_loader.Load(template_file) 401 has_contains = any(op.id == 'contains' for op in self._interface.operations)
402 template = self._template_loader.Load(
403 template_file,
404 {'DEFINE_CONTAINS': not has_contains})
402 self._members_emitter.Emit(template, E=dart_element_type) 405 self._members_emitter.Emit(template, E=dart_element_type)
403 406
404 def AmendIndexer(self, element_type): 407 def AmendIndexer(self, element_type):
405 # If interface is marked as having native indexed 408 # If interface is marked as having native indexed
406 # getter or setter, we must emit overrides as it's not 409 # getter or setter, we must emit overrides as it's not
407 # guaranteed that the corresponding methods in C++ would be 410 # guaranteed that the corresponding methods in C++ would be
408 # virtual. For example, as of time of writing, even though 411 # virtual. For example, as of time of writing, even though
409 # Uint8ClampedArray inherits from Uint8Array, ::set method 412 # Uint8ClampedArray inherits from Uint8Array, ::set method
410 # is not virtual and accessing it through Uint8Array pointer 413 # is not virtual and accessing it through Uint8Array pointer
411 # would lead to wrong semantics (modulo vs. clamping.) 414 # would lead to wrong semantics (modulo vs. clamping.)
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 def EmitResolver(self, template, output_dir): 864 def EmitResolver(self, template, output_dir):
862 file_path = os.path.join(output_dir, 'DartResolver.cpp') 865 file_path = os.path.join(output_dir, 'DartResolver.cpp')
863 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) 866 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template)
864 for header_file in self._headers_list: 867 for header_file in self._headers_list:
865 path = os.path.relpath(header_file, output_dir) 868 path = os.path.relpath(header_file, output_dir)
866 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 869 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
867 body_emitter.Emit( 870 body_emitter.Emit(
868 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' 871 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n'
869 ' return func;\n', 872 ' return func;\n',
870 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 873 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « lib/html/scripts/systemhtml.py ('k') | lib/html/scripts/templateloader.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698