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 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 logging | 10 import logging |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly': | 594 if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly': |
595 js_interop_equivalence_op = '' | 595 js_interop_equivalence_op = '' |
596 | 596 |
597 js_interop_wrapper = ''' | 597 js_interop_wrapper = ''' |
598 | 598 |
599 static {0} internalCreate{0}() {{ | 599 static {0} internalCreate{0}() {{ |
600 return new {0}._internalWrap(); | 600 return new {0}._internalWrap(); |
601 }} | 601 }} |
602 | 602 |
603 factory {0}._internalWrap() {{ | 603 factory {0}._internalWrap() {{ |
604 return new {0}._internal(); | 604 return new {0}.internal_(); |
605 }} | 605 }} |
606 | 606 |
607 {0}._internal() : super._internal(); | 607 {0}.internal_() : super.internal_(); |
608 | 608 |
609 '''.format(class_name) | 609 '''.format(class_name) |
610 """ | 610 """ |
611 TODO(terry): Don't use Dart expando really don't need. | 611 TODO(terry): Don't use Dart expando really don't need. |
612 final Object expandoJsObject = new Object(); | 612 final Object expandoJsObject = new Object(); |
613 final Expando<JsObject> dartium_expando = new Expando<JsObject>("Expando_j
sObject"); | 613 final Expando<JsObject> dartium_expando = new Expando<JsObject>("Expando_j
sObject"); |
614 """ | 614 """ |
615 if base_class == 'NativeFieldWrapperClass2': | 615 if base_class == 'NativeFieldWrapperClass2': |
616 js_interop_wrapper = ''' | 616 js_interop_wrapper = ''' |
617 static {0} internalCreate{0}() {{ | 617 static {0} internalCreate{0}() {{ |
618 return new {0}._internalWrap(); | 618 return new {0}._internalWrap(); |
619 }} | 619 }} |
620 | 620 |
621 JsObject blink_jsObject = null; | 621 JsObject blink_jsObject = null; |
622 | 622 |
623 factory {0}._internalWrap() {{ | 623 factory {0}._internalWrap() {{ |
624 return new {0}._internal(); | 624 return new {0}.internal_(); |
625 }} | 625 }} |
626 | 626 |
627 {0}._internal() {{ }} | 627 {0}.internal_() {{ }} |
628 | 628 |
629 {1}'''.format(class_name, js_interop_equivalence_op) | 629 {1}'''.format(class_name, js_interop_equivalence_op) |
630 # Change to use the synthesized class so we can construct with a mixin | 630 # Change to use the synthesized class so we can construct with a mixin |
631 # classes prefixed with name of NativeFieldWrapperClass don't have a | 631 # classes prefixed with name of NativeFieldWrapperClass don't have a |
632 # default constructor so classes with mixins can't be new'd. | 632 # default constructor so classes with mixins can't be new'd. |
633 if (self._options.templates._conditions['DARTIUM'] and | 633 if (self._options.templates._conditions['DARTIUM'] and |
634 self._options.dart_js_interop and | 634 self._options.dart_js_interop and |
635 (self._interface.id == 'NamedNodeMap' or | 635 (self._interface.id == 'NamedNodeMap' or |
636 self._interface.id == 'CSSStyleDeclaration')): | 636 self._interface.id == 'CSSStyleDeclaration')): |
637 base_class = 'JsoNativeFieldWrapper2' | 637 base_class = 'JsoNativeFieldWrapper2' |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1370 |
1371 def AddFile(self, basename, library_name, path): | 1371 def AddFile(self, basename, library_name, path): |
1372 self._libraries[library_name].AddFile(path) | 1372 self._libraries[library_name].AddFile(path) |
1373 | 1373 |
1374 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1374 def AddTypeEntry(self, library_name, idl_name, dart_name): |
1375 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1375 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
1376 | 1376 |
1377 def Emit(self, emitter, auxiliary_dir): | 1377 def Emit(self, emitter, auxiliary_dir): |
1378 for lib in self._libraries.values(): | 1378 for lib in self._libraries.values(): |
1379 lib.Emit(emitter, auxiliary_dir) | 1379 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |