OLD | NEW |
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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 return (dart_name, resolver_string) | 551 return (dart_name, resolver_string) |
552 | 552 |
553 | 553 |
554 def DeriveNativeName(self, name, suffix=""): | 554 def DeriveNativeName(self, name, suffix=""): |
555 fields = ['$' + name] | 555 fields = ['$' + name] |
556 if suffix != "": | 556 if suffix != "": |
557 fields.append(suffix) | 557 fields.append(suffix) |
558 return "_".join(fields) | 558 return "_".join(fields) |
559 | 559 |
560 def DeriveQualifiedBlinkName(self, interface_name, name): | 560 def DeriveQualifiedBlinkName(self, interface_name, name): |
561 return DeriveQualifiedName( | 561 blinkClass = DeriveQualifiedName( |
562 "_blink", DeriveQualifiedName(DeriveBlinkClassName(interface_name), | 562 "_blink", DeriveBlinkClassName(interface_name)) |
563 name)) | 563 blinkInstance = DeriveQualifiedName(blinkClass, "instance") |
| 564 return DeriveQualifiedName(blinkInstance, name + "_") |
564 | 565 |
565 def NativeSpec(self): | 566 def NativeSpec(self): |
566 return '' | 567 return '' |
567 | 568 |
568 def StartInterface(self, members_emitter): | 569 def StartInterface(self, members_emitter): |
569 # Create emitters for c++ implementation. | 570 # Create emitters for c++ implementation. |
570 if not IsPureInterface(self._interface.id) and \ | 571 if not IsPureInterface(self._interface.id) and \ |
571 not IsCustomType(self._interface.id): | 572 not IsCustomType(self._interface.id): |
572 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( | 573 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( |
573 self._interface.id, | 574 self._interface.id, |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 | 1907 |
1907 def _IsCustom(op_or_attr): | 1908 def _IsCustom(op_or_attr): |
1908 assert(isinstance(op_or_attr, IDLMember)) | 1909 assert(isinstance(op_or_attr, IDLMember)) |
1909 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 1910 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
1910 | 1911 |
1911 def _IsCustomValue(op_or_attr, value): | 1912 def _IsCustomValue(op_or_attr, value): |
1912 if _IsCustom(op_or_attr): | 1913 if _IsCustom(op_or_attr): |
1913 return op_or_attr.ext_attrs.get('Custom') == value \ | 1914 return op_or_attr.ext_attrs.get('Custom') == value \ |
1914 or op_or_attr.ext_attrs.get('DartCustom') == value | 1915 or op_or_attr.ext_attrs.get('DartCustom') == value |
1915 return False | 1916 return False |
OLD | NEW |