| 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 systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 _alternate_methods = { | 144 _alternate_methods = { |
| 145 ('WheelEvent', 'initWheelEvent'): ['initWebKitWheelEvent', 'initWheelEvent'] | 145 ('WheelEvent', 'initWheelEvent'): ['initWebKitWheelEvent', 'initWheelEvent'] |
| 146 } | 146 } |
| 147 | 147 |
| 148 # | 148 # |
| 149 # Custom native bodies for frog implementations of dom operations that appear in | 149 # Custom native bodies for frog implementations of dom operations that appear in |
| 150 # dart:dom and dart:html. This is used to work-around the lack of a 'rename' | 150 # dart:dom and dart:html. This is used to work-around the lack of a 'rename' |
| 151 # feature in the 'native' string - the correct name is available on the DartName | 151 # feature in the 'native' string - the correct name is available on the DartName |
| 152 # extended attribute. See Issue 1814 | 152 # extended attribute. See Issue 1814 |
| 153 # | 153 # |
| 154 _dom_frog_native_typed_array_set_operation = """ | |
| 155 if (offset == null) return this.set(array); | |
| 156 return this.set(array, offset);""" | |
| 157 | |
| 158 dom_frog_native_bodies = { | 154 dom_frog_native_bodies = { |
| 155 # Some JavaScript processors, especially tools like yuicompress and |
| 156 # JSCompiler, choke on 'this.continue' |
| 159 'IDBCursor.continueFunction': | 157 'IDBCursor.continueFunction': |
| 160 """ | 158 """ |
| 161 if (key == null) return this['continue'](); | 159 if (key == null) return this['continue'](); |
| 162 return this['continue'](key); | 160 return this['continue'](key); |
| 163 """, | 161 """, |
| 164 'IDBIndex.getObject': """return this.get(key);""", | |
| 165 'IDBObjectStore.getObject': """return this.get(key);""", | |
| 166 'Float32Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 167 'Float64Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 168 'Int16Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 169 'Int32Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 170 'Int8Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 171 'Uint16Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 172 'Uint32Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 173 'Uint8Array.setElements': _dom_frog_native_typed_array_set_operation, | |
| 174 'Uint8ClampedArray.setElements': _dom_frog_native_typed_array_set_operation, | |
| 175 } | 162 } |
| 176 | 163 |
| 177 | 164 |
| 178 def ConvertPrimitiveType(type_name): | 165 def ConvertPrimitiveType(type_name): |
| 179 if type_name.startswith('unsigned '): | 166 if type_name.startswith('unsigned '): |
| 180 type_name = type_name[len('unsigned '):] | 167 type_name = type_name[len('unsigned '):] |
| 181 | 168 |
| 182 if type_name in _idl_to_dart_type_conversions: | 169 if type_name in _idl_to_dart_type_conversions: |
| 183 # Primitive type conversion | 170 # Primitive type conversion |
| 184 return _idl_to_dart_type_conversions[type_name] | 171 return _idl_to_dart_type_conversions[type_name] |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 '"SVGAnimatedPropertyTearOff.h"', | 671 '"SVGAnimatedPropertyTearOff.h"', |
| 685 '"SVGAnimatedListPropertyTearOff.h"', | 672 '"SVGAnimatedListPropertyTearOff.h"', |
| 686 '"SVGStaticListPropertyTearOff.h"', | 673 '"SVGStaticListPropertyTearOff.h"', |
| 687 '"SVGAnimatedListPropertyTearOff.h"', | 674 '"SVGAnimatedListPropertyTearOff.h"', |
| 688 '"SVGTransformListPropertyTearOff.h"', | 675 '"SVGTransformListPropertyTearOff.h"', |
| 689 '"SVGPathSegListPropertyTearOff.h"', | 676 '"SVGPathSegListPropertyTearOff.h"', |
| 690 ] | 677 ] |
| 691 | 678 |
| 692 def GetIDLTypeInfo(idl_type_name): | 679 def GetIDLTypeInfo(idl_type_name): |
| 693 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 680 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |