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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 else: | 582 else: |
583 class_modifiers = 'abstract ' | 583 class_modifiers = 'abstract ' |
584 | 584 |
585 native_spec = '' | 585 native_spec = '' |
586 if not IsPureInterface(self._interface.id): | 586 if not IsPureInterface(self._interface.id): |
587 native_spec = self._backend.NativeSpec() | 587 native_spec = self._backend.NativeSpec() |
588 | 588 |
589 class_name = self._interface_type_info.implementation_name() | 589 class_name = self._interface_type_info.implementation_name() |
590 | 590 |
591 js_interop_equivalence_op = \ | 591 js_interop_equivalence_op = \ |
592 ' bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || ide
ntical(this, other);\n' | 592 ' bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || ide
ntical(this, other);\n' \ |
| 593 + ' int get hashCode => unwrap_jso(this).hashCode;\n' |
593 # ClientRect overrides the equivalence operator. | 594 # ClientRect overrides the equivalence operator. |
594 if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly': | 595 if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly': |
595 js_interop_equivalence_op = '' | 596 js_interop_equivalence_op = '' |
596 | 597 |
597 js_interop_wrapper = ''' | 598 js_interop_wrapper = ''' |
598 | 599 |
599 static {0} internalCreate{0}() {{ | 600 static {0} internalCreate{0}() {{ |
600 return new {0}._internalWrap(); | 601 return new {0}._internalWrap(); |
601 }} | 602 }} |
602 | 603 |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1371 |
1371 def AddFile(self, basename, library_name, path): | 1372 def AddFile(self, basename, library_name, path): |
1372 self._libraries[library_name].AddFile(path) | 1373 self._libraries[library_name].AddFile(path) |
1373 | 1374 |
1374 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1375 def AddTypeEntry(self, library_name, idl_name, dart_name): |
1375 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1376 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
1376 | 1377 |
1377 def Emit(self, emitter, auxiliary_dir): | 1378 def Emit(self, emitter, auxiliary_dir): |
1378 for lib in self._libraries.values(): | 1379 for lib in self._libraries.values(): |
1379 lib.Emit(emitter, auxiliary_dir) | 1380 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |