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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 self._interface) | 487 self._interface) |
488 | 488 |
489 code.Emit('$(ANNOTATIONS)typedef void $NAME($PARAMS);\n', | 489 code.Emit('$(ANNOTATIONS)typedef void $NAME($PARAMS);\n', |
490 ANNOTATIONS=annotations, | 490 ANNOTATIONS=annotations, |
491 NAME=typedef_name, | 491 NAME=typedef_name, |
492 PARAMS=info.ParametersAsDeclaration(self._DartType)) | 492 PARAMS=info.ParametersAsDeclaration(self._DartType)) |
493 self._backend.GenerateCallback(info) | 493 self._backend.GenerateCallback(info) |
494 | 494 |
495 def GenerateInterface(self): | 495 def GenerateInterface(self): |
496 interface_name = self._interface_type_info.interface_name() | 496 interface_name = self._interface_type_info.interface_name() |
| 497 |
497 implementation_name = self._interface_type_info.implementation_name() | 498 implementation_name = self._interface_type_info.implementation_name() |
498 self._library_emitter.AddTypeEntry(self._library_name, | 499 self._library_emitter.AddTypeEntry(self._library_name, |
499 self._interface.id, implementation_name) | 500 self._interface.id, implementation_name) |
500 | 501 |
501 factory_provider = None | 502 factory_provider = None |
502 if interface_name in interface_factories: | 503 if interface_name in interface_factories: |
503 factory_provider = interface_factories[interface_name] | 504 factory_provider = interface_factories[interface_name] |
504 factory_constructor_name = None | 505 factory_constructor_name = None |
505 | 506 |
506 constructors = [] | 507 constructors = [] |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 secure_base_name = self._backend.SecureBaseName(interface_name) | 553 secure_base_name = self._backend.SecureBaseName(interface_name) |
553 if secure_base_name: | 554 if secure_base_name: |
554 implements.append(secure_base_name) | 555 implements.append(secure_base_name) |
555 | 556 |
556 implements_str = '' | 557 implements_str = '' |
557 if implements: | 558 if implements: |
558 implements_str = ' implements ' + ', '.join(set(implements)) | 559 implements_str = ' implements ' + ', '.join(set(implements)) |
559 | 560 |
560 mixins = self._backend.Mixins() | 561 mixins = self._backend.Mixins() |
561 | 562 |
562 # TODO(terry): Do we need a more generic solution other than handling NamedN
odeMap | |
563 # we can't call super on a mixin interface - yet. | |
564 if self._options.templates._conditions['DARTIUM'] and self._options.dart_js_
interop and self._interface.id == 'NamedNodeMap': | |
565 mixins = None | |
566 mixins_str = '' | 563 mixins_str = '' |
567 if mixins: | 564 if mixins: |
568 mixins_str = ' with ' + ', '.join(mixins) | 565 mixins_str = ' with ' + ', '.join(mixins) |
569 if not base_class: | 566 if not base_class: |
570 base_class = 'Interceptor' | 567 base_class = 'Interceptor' |
| 568 elif (base_class == 'NativeFieldWrapperClass2' and |
| 569 self._options.dart_js_interop and |
| 570 not(isinstance(self._backend, Dart2JSBackend))): |
| 571 base_class = 'JsoNativeFieldWrapper' |
571 | 572 |
572 annotations = self._metadata.GetFormattedMetadata( | 573 annotations = self._metadata.GetFormattedMetadata( |
573 self._library_name, self._interface, None, '') | 574 self._library_name, self._interface, None, '') |
574 | 575 |
575 class_modifiers = '' | 576 class_modifiers = '' |
576 if (self._renamer.ShouldSuppressInterface(self._interface) or | 577 if (self._renamer.ShouldSuppressInterface(self._interface) or |
577 IsPureInterface(self._interface.id)): | 578 IsPureInterface(self._interface.id)): |
578 # XMLHttpRequestProgressEvent can't be abstract we need to instantiate | 579 # XMLHttpRequestProgressEvent can't be abstract we need to instantiate |
579 # for JsInterop. | 580 # for JsInterop. |
580 if (not(isinstance(self._backend, Dart2JSBackend)) and | 581 if (not(isinstance(self._backend, Dart2JSBackend)) and |
581 self._interface.id == 'XMLHttpRequestProgressEvent'): | 582 (self._interface.id == 'XMLHttpRequestProgressEvent' or |
582 # Only suppress abstract for XMLHttpRequestProgressEvent for Dartium. | 583 self._interface.id == 'DOMStringMap')): |
583 # Need to be able to instantiate the class; can't be abstract. | 584 # Suppress abstract for XMLHttpRequestProgressEvent and DOMStringMap |
| 585 # for Dartium. Need to be able to instantiate the class; can't be abstr
act. |
584 class_modifiers = '' | 586 class_modifiers = '' |
585 else: | 587 else: |
586 class_modifiers = 'abstract ' | 588 # For Dartium w/ JsInterop these suppressed interfaces are needed to |
| 589 # instanciate the internal classes when wrap_jso is called for a JS obje
ct. |
| 590 if (self._renamer.ShouldSuppressInterface(self._interface) and |
| 591 not(isinstance(self._backend, Dart2JSBackend)) and |
| 592 self._options.dart_js_interop): |
| 593 class_modifiers = '' |
| 594 else: |
| 595 class_modifiers = 'abstract ' |
587 | 596 |
588 native_spec = '' | 597 native_spec = '' |
589 if not IsPureInterface(self._interface.id): | 598 if not IsPureInterface(self._interface.id): |
590 native_spec = self._backend.NativeSpec() | 599 native_spec = self._backend.NativeSpec() |
591 | 600 |
592 class_name = self._interface_type_info.implementation_name() | 601 class_name = self._interface_type_info.implementation_name() |
593 | 602 |
594 js_interop_equivalence_op = \ | 603 js_interop_equivalence_op = \ |
595 ' bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || ide
ntical(this, other);\n' | 604 ' bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || ide
ntical(this, other);\n' \ |
| 605 + ' int get hashCode => unwrap_jso(this).hashCode;\n' |
596 # ClientRect overrides the equivalence operator. | 606 # ClientRect overrides the equivalence operator. |
597 if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly': | 607 if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly': |
598 js_interop_equivalence_op = '' | 608 js_interop_equivalence_op = '' |
599 | 609 |
600 js_interop_wrapper = ''' | 610 js_interop_wrapper = ''' |
601 | 611 |
602 static {0} internalCreate{0}() {{ | 612 static {0} internalCreate{0}() {{ |
603 return new {0}._internalWrap(); | 613 return new {0}._internalWrap(); |
604 }} | 614 }} |
605 | 615 |
606 factory {0}._internalWrap() {{ | 616 factory {0}._internalWrap() {{ |
607 return new {0}._internal(); | 617 return new {0}.internal_(); |
608 }} | 618 }} |
609 | 619 |
610 {0}._internal() : super._internal(); | 620 {0}.internal_() : super.internal_(); |
611 | 621 |
612 '''.format(class_name) | 622 '''.format(class_name) |
613 """ | 623 if base_class == 'NativeFieldWrapperClass2' or base_class == 'JsoNativeField
Wrapper': |
614 TODO(terry): Don't use Dart expando really don't need. | |
615 final Object expandoJsObject = new Object(); | |
616 final Expando<JsObject> dartium_expando = new Expando<JsObject>("Expando_j
sObject"); | |
617 """ | |
618 if base_class == 'NativeFieldWrapperClass2': | |
619 js_interop_wrapper = ''' | 624 js_interop_wrapper = ''' |
620 static {0} internalCreate{0}() {{ | 625 static {0} internalCreate{0}() {{ |
621 return new {0}._internalWrap(); | 626 return new {0}._internalWrap(); |
622 }} | 627 }} |
623 | 628 |
624 JsObject blink_jsObject = null; | 629 js.JsObject blink_jsObject; |
625 | 630 |
626 factory {0}._internalWrap() {{ | 631 factory {0}._internalWrap() {{ |
627 return new {0}._internal(); | 632 return new {0}.internal_(); |
628 }} | 633 }} |
629 | 634 |
630 {0}._internal() {{ }} | 635 {0}.internal_() {{ }} |
631 | 636 |
632 {1}'''.format(class_name, js_interop_equivalence_op) | 637 {1}'''.format(class_name, js_interop_equivalence_op) |
| 638 # Change to use the synthesized class so we can construct with a mixin |
| 639 # classes prefixed with name of NativeFieldWrapperClass2 don't have a |
| 640 # default constructor so classes with mixins can't be new'd. |
| 641 if (self._options.templates._conditions['DARTIUM'] and |
| 642 self._options.dart_js_interop and |
| 643 (self._interface.id == 'NamedNodeMap' or |
| 644 self._interface.id == 'CSSStyleDeclaration')): |
| 645 base_class = 'JsoNativeFieldWrapper' |
633 | 646 |
634 implementation_members_emitter = implementation_emitter.Emit( | 647 implementation_members_emitter = implementation_emitter.Emit( |
635 self._backend.ImplementationTemplate(), | 648 self._backend.ImplementationTemplate(), |
636 LIBRARYNAME='dart.dom.%s' % self._library_name, | 649 LIBRARYNAME='dart.dom.%s' % self._library_name, |
637 ANNOTATIONS=annotations, | 650 ANNOTATIONS=annotations, |
638 CLASS_MODIFIERS=class_modifiers, | 651 CLASS_MODIFIERS=class_modifiers, |
639 CLASSNAME=self._interface_type_info.implementation_name(), | 652 CLASSNAME=class_name, |
640 EXTENDS=' extends %s' % base_class if base_class else '', | 653 EXTENDS=' extends %s' % base_class if base_class else '', |
641 IMPLEMENTS=implements_str, | 654 IMPLEMENTS=implements_str, |
642 MIXINS=mixins_str, | 655 MIXINS=mixins_str, |
643 DOMNAME=self._interface.doc_js_name, | 656 DOMNAME=self._interface.doc_js_name, |
644 NATIVESPEC=native_spec) | 657 NATIVESPEC=native_spec) |
645 stream_getter_signatures_emitter = None | 658 stream_getter_signatures_emitter = None |
646 element_stream_getters_emitter = None | 659 element_stream_getters_emitter = None |
647 if type(implementation_members_emitter) == tuple: | 660 if type(implementation_members_emitter) == tuple: |
648 # We add event stream getters for both Element and ElementList, so in | 661 # We add event stream getters for both Element and ElementList, so in |
649 # impl_Element.darttemplate, we have two additional "holes" for emitters | 662 # impl_Element.darttemplate, we have two additional "holes" for emitters |
(...skipping 16 matching lines...) Expand all Loading... |
666 constructors, factory_provider, factory_constructor_name) | 679 constructors, factory_provider, factory_constructor_name) |
667 | 680 |
668 isElement = False | 681 isElement = False |
669 for parent in self._database.Hierarchy(self._interface): | 682 for parent in self._database.Hierarchy(self._interface): |
670 if parent.id == 'Element': | 683 if parent.id == 'Element': |
671 isElement = True | 684 isElement = True |
672 | 685 |
673 # Write out the JsInterop code. | 686 # Write out the JsInterop code. |
674 if (implementation_members_emitter and | 687 if (implementation_members_emitter and |
675 self._options.templates._conditions['DARTIUM'] and | 688 self._options.templates._conditions['DARTIUM'] and |
676 self._options.dart_js_interop): | 689 self._options.dart_js_interop and |
| 690 not IsPureInterface(self._interface.id)): |
677 implementation_members_emitter.Emit(js_interop_wrapper) | 691 implementation_members_emitter.Emit(js_interop_wrapper) |
678 | 692 |
679 if isElement and self._interface.id != 'Element': | 693 if isElement and self._interface.id != 'Element': |
680 implementation_members_emitter.Emit( | 694 implementation_members_emitter.Emit( |
681 ' /**\n' | 695 ' /**\n' |
682 ' * Constructor instantiated by the DOM when a custom element has be
en created.\n' | 696 ' * Constructor instantiated by the DOM when a custom element has be
en created.\n' |
683 ' *\n' | 697 ' *\n' |
684 ' * This can only be called by subclasses from their created constru
ctor.\n' | 698 ' * This can only be called by subclasses from their created constru
ctor.\n' |
685 ' */\n' | 699 ' */\n' |
686 ' $CLASSNAME.created() : super.created();\n', | 700 ' $CLASSNAME.created() : super.created();\n', |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 TYPE=return_type, | 987 TYPE=return_type, |
974 NATIVE_TYPE=native_type) | 988 NATIVE_TYPE=native_type) |
975 | 989 |
976 def _AddRenamingSetter(self, attr, html_name): | 990 def _AddRenamingSetter(self, attr, html_name): |
977 | 991 |
978 conversion = self._InputConversion(attr.type.id, attr.id) | 992 conversion = self._InputConversion(attr.type.id, attr.id) |
979 if conversion: | 993 if conversion: |
980 return self._AddConvertingSetter(attr, html_name, conversion) | 994 return self._AddConvertingSetter(attr, html_name, conversion) |
981 self._members_emitter.Emit( | 995 self._members_emitter.Emit( |
982 # TODO(sra): Use metadata to provide native name. | 996 # TODO(sra): Use metadata to provide native name. |
983 '\n void set $HTML_NAME($TYPE value) {' | 997 '\n set $HTML_NAME($TYPE value) {' |
984 '\n JS("void", "#.$NAME = #", this, value);' | 998 '\n JS("void", "#.$NAME = #", this, value);' |
985 '\n }' | 999 '\n }' |
986 '\n', | 1000 '\n', |
987 HTML_NAME=html_name, | 1001 HTML_NAME=html_name, |
988 NAME=attr.id, | 1002 NAME=attr.id, |
989 TYPE=self._NarrowInputType(attr.type.id)) | 1003 TYPE=self._NarrowInputType(attr.type.id)) |
990 | 1004 |
991 def _AddConvertingGetter(self, attr, html_name, conversion): | 1005 def _AddConvertingGetter(self, attr, html_name, conversion): |
992 self._members_emitter.Emit( | 1006 self._members_emitter.Emit( |
993 '\n $(METADATA)$RETURN_TYPE get $HTML_NAME => ' | 1007 '\n $(METADATA)$RETURN_TYPE get $HTML_NAME => ' |
994 '$CONVERT(this._get_$(HTML_NAME));' | 1008 '$CONVERT(this._get_$(HTML_NAME));' |
995 "\n @JSName('$NAME')" | 1009 "\n @JSName('$NAME')" |
996 '\n $(JS_METADATA)final $NATIVE_TYPE _get_$HTML_NAME;' | 1010 '\n $(JS_METADATA)final $NATIVE_TYPE _get_$HTML_NAME;' |
997 '\n', | 1011 '\n', |
998 METADATA=self._metadata.GetFormattedMetadata( | 1012 METADATA=self._metadata.GetFormattedMetadata( |
999 self._library_name, self._interface, html_name, ' '), | 1013 self._library_name, self._interface, html_name, ' '), |
1000 JS_METADATA=self._Metadata(attr.type.id, html_name, conversion.input_typ
e), | 1014 JS_METADATA=self._Metadata(attr.type.id, html_name, conversion.input_typ
e), |
1001 CONVERT=conversion.function_name, | 1015 CONVERT=conversion.function_name, |
1002 HTML_NAME=html_name, | 1016 HTML_NAME=html_name, |
1003 NAME=attr.id, | 1017 NAME=attr.id, |
1004 RETURN_TYPE=conversion.output_type, | 1018 RETURN_TYPE=conversion.output_type, |
1005 NATIVE_TYPE=conversion.input_type) | 1019 NATIVE_TYPE=conversion.input_type) |
1006 | 1020 |
1007 def _AddConvertingSetter(self, attr, html_name, conversion): | 1021 def _AddConvertingSetter(self, attr, html_name, conversion): |
1008 self._members_emitter.Emit( | 1022 self._members_emitter.Emit( |
1009 # TODO(sra): Use metadata to provide native name. | 1023 # TODO(sra): Use metadata to provide native name. |
1010 '\n void set $HTML_NAME($INPUT_TYPE value) {' | 1024 '\n set $HTML_NAME($INPUT_TYPE value) {' |
1011 '\n this._set_$HTML_NAME = $CONVERT(value);' | 1025 '\n this._set_$HTML_NAME = $CONVERT(value);' |
1012 '\n }' | 1026 '\n }' |
1013 '\n void set _set_$HTML_NAME(/*$NATIVE_TYPE*/ value) {' | 1027 '\n set _set_$HTML_NAME(/*$NATIVE_TYPE*/ value) {' |
1014 '\n JS("void", "#.$NAME = #", this, value);' | 1028 '\n JS("void", "#.$NAME = #", this, value);' |
1015 '\n }' | 1029 '\n }' |
1016 '\n', | 1030 '\n', |
1017 CONVERT=conversion.function_name, | 1031 CONVERT=conversion.function_name, |
1018 HTML_NAME=html_name, | 1032 HTML_NAME=html_name, |
1019 NAME=attr.id, | 1033 NAME=attr.id, |
1020 INPUT_TYPE=conversion.input_type, | 1034 INPUT_TYPE=conversion.input_type, |
1021 NATIVE_TYPE=conversion.output_type) | 1035 NATIVE_TYPE=conversion.output_type) |
1022 | 1036 |
1023 def AmendIndexer(self, element_type): | 1037 def AmendIndexer(self, element_type): |
(...skipping 28 matching lines...) Expand all Loading... |
1052 '\n' | 1066 '\n' |
1053 ' $RENAME$METADATA$MODIFIERS$TYPE $NAME($PARAMS) native;\n', | 1067 ' $RENAME$METADATA$MODIFIERS$TYPE $NAME($PARAMS) native;\n', |
1054 RENAME=self._RenamingAnnotation(info.declared_name, html_name), | 1068 RENAME=self._RenamingAnnotation(info.declared_name, html_name), |
1055 METADATA=self._Metadata(info.type_name, info.declared_name, | 1069 METADATA=self._Metadata(info.type_name, info.declared_name, |
1056 self.SecureOutputType(info.type_name)), | 1070 self.SecureOutputType(info.type_name)), |
1057 MODIFIERS='static ' if info.IsStatic() else '', | 1071 MODIFIERS='static ' if info.IsStatic() else '', |
1058 TYPE=self.SecureOutputType(info.type_name, False, True), | 1072 TYPE=self.SecureOutputType(info.type_name, False, True), |
1059 NAME=html_name, | 1073 NAME=html_name, |
1060 PARAMS=info.ParametersAsDeclaration(self._NarrowInputType)) | 1074 PARAMS=info.ParametersAsDeclaration(self._NarrowInputType)) |
1061 | 1075 |
1062 def _ConvertArgumentTypes( | |
1063 self, stmts_emitter, arguments, argument_count, info): | |
1064 temp_version = [0] | |
1065 converted_arguments = [] | |
1066 target_parameters = [] | |
1067 for position, arg in enumerate(arguments[:argument_count]): | |
1068 conversion = self._InputConversion(arg.type.id, info.declared_name) | |
1069 param_name = arguments[position].id | |
1070 if conversion: | |
1071 temp_version[0] += 1 | |
1072 temp_name = '%s_%s' % (param_name, temp_version[0]) | |
1073 temp_type = conversion.output_type | |
1074 stmts_emitter.Emit( | |
1075 '$(INDENT)$TYPE $NAME = $CONVERT($ARG);\n', | |
1076 TYPE=TypeOrVar(temp_type), | |
1077 NAME=temp_name, | |
1078 CONVERT=conversion.function_name, | |
1079 ARG=info.param_infos[position].name) | |
1080 converted_arguments.append(temp_name) | |
1081 param_type = temp_type | |
1082 verified_type = temp_type # verified by assignment in checked mode. | |
1083 else: | |
1084 converted_arguments.append(info.param_infos[position].name) | |
1085 param_type = self._NarrowInputType(arg.type.id) | |
1086 # Verified by argument checking on entry to the dispatcher. | |
1087 | |
1088 verified_type = self._InputType( | |
1089 info.param_infos[position].type_id, info) | |
1090 # The native method does not need an argument type if we know the type. | |
1091 # But we do need the native methods to have correct function types, so | |
1092 # be conservative. | |
1093 if param_type == verified_type: | |
1094 if param_type in ['String', 'num', 'int', 'double', 'bool', 'Object']: | |
1095 param_type = 'dynamic' | |
1096 | |
1097 target_parameters.append( | |
1098 '%s%s' % (TypeOrNothing(param_type), param_name)) | |
1099 | |
1100 return target_parameters, converted_arguments | |
1101 | |
1102 def _InputType(self, type_name, info): | |
1103 conversion = self._InputConversion(type_name, info.declared_name) | |
1104 if conversion: | |
1105 return conversion.input_type | |
1106 else: | |
1107 return self._NarrowInputType(type_name) if type_name else 'dynamic' | |
1108 | |
1109 def _AddOperationWithConversions(self, info, html_name): | 1076 def _AddOperationWithConversions(self, info, html_name): |
1110 # Assert all operations have same return type. | 1077 # Assert all operations have same return type. |
1111 assert len(set([op.type.id for op in info.operations])) == 1 | 1078 assert len(set([op.type.id for op in info.operations])) == 1 |
1112 output_conversion = self._OutputConversion(info.type_name, | 1079 output_conversion = self._OutputConversion(info.type_name, |
1113 info.declared_name) | 1080 info.declared_name) |
1114 if output_conversion: | 1081 if output_conversion: |
1115 return_type = output_conversion.output_type | 1082 return_type = output_conversion.output_type |
1116 native_return_type = output_conversion.input_type | 1083 native_return_type = output_conversion.input_type |
1117 else: | 1084 else: |
1118 return_type = self._NarrowInputType(info.type_name) | 1085 return_type = self._NarrowInputType(info.type_name) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 map_emitter.Emit( | 1306 map_emitter.Emit( |
1340 " '$IDL_NAME': () => $DART_NAME,\n", | 1307 " '$IDL_NAME': () => $DART_NAME,\n", |
1341 IDL_NAME=idl_name, | 1308 IDL_NAME=idl_name, |
1342 DART_NAME=dart_name) | 1309 DART_NAME=dart_name) |
1343 | 1310 |
1344 # Emit the $!TYPE_FUNCTION_MAP | 1311 # Emit the $!TYPE_FUNCTION_MAP |
1345 if function_emitter: | 1312 if function_emitter: |
1346 items = self._typeMap.items() | 1313 items = self._typeMap.items() |
1347 items.sort() | 1314 items.sort() |
1348 for (idl_name, dart_name) in items: | 1315 for (idl_name, dart_name) in items: |
1349 function_emitter.Emit( | 1316 # DOMStringMap is in the abstract list but is used as a concrete class |
1350 " '$IDL_NAME': () => $DART_NAME.internalCreate$DART_NAME,\n", | 1317 # in Dartium. |
1351 IDL_NAME=idl_name, | 1318 if not IsPureInterface(idl_name): |
1352 DART_NAME=dart_name) | 1319 # Handle classes that are concrete (abstract can't be instantiated). |
| 1320 function_emitter.Emit( |
| 1321 " '$IDL_NAME': () => $DART_NAME.internalCreate$DART_NAME,\n", |
| 1322 IDL_NAME=idl_name, |
| 1323 DART_NAME=dart_name) |
1353 if self._dart_path.endswith('html_dartium.dart'): | 1324 if self._dart_path.endswith('html_dartium.dart'): |
1354 function_emitter.Emit(" 'polymer-element': () => HtmlElement.internalCr
eateHtmlElement,\n") | 1325 function_emitter.Emit(" 'polymer-element': () => HtmlElement.internalCr
eateHtmlElement,\n") |
1355 | 1326 |
1356 | 1327 |
1357 # ------------------------------------------------------------------------------ | 1328 # ------------------------------------------------------------------------------ |
1358 | 1329 |
1359 class DartLibraries(): | 1330 class DartLibraries(): |
1360 def __init__(self, libraries, template_loader, library_type, output_dir, dart_
js_interop): | 1331 def __init__(self, libraries, template_loader, library_type, output_dir, dart_
js_interop): |
1361 self._libraries = {} | 1332 self._libraries = {} |
1362 for library_name in libraries: | 1333 for library_name in libraries: |
1363 self._libraries[library_name] = DartLibrary( | 1334 self._libraries[library_name] = DartLibrary( |
1364 library_name, template_loader, library_type, output_dir, dart_js_inter
op) | 1335 library_name, template_loader, library_type, output_dir, dart_js_inter
op) |
1365 | 1336 |
1366 def AddFile(self, basename, library_name, path): | 1337 def AddFile(self, basename, library_name, path): |
1367 self._libraries[library_name].AddFile(path) | 1338 self._libraries[library_name].AddFile(path) |
1368 | 1339 |
1369 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1340 def AddTypeEntry(self, library_name, idl_name, dart_name): |
1370 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1341 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
1371 | 1342 |
1372 def Emit(self, emitter, auxiliary_dir): | 1343 def Emit(self, emitter, auxiliary_dir): |
1373 for lib in self._libraries.values(): | 1344 for lib in self._libraries.values(): |
1374 lib.Emit(emitter, auxiliary_dir) | 1345 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |