| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return None | 103 return None |
| 104 | 104 |
| 105 def MaybeTypedArrayElementType(interface): | 105 def MaybeTypedArrayElementType(interface): |
| 106 """Returns the typed array element type, or None in interface is not a | 106 """Returns the typed array element type, or None in interface is not a |
| 107 TypedArray. | 107 TypedArray. |
| 108 """ | 108 """ |
| 109 # Typed arrays implement ArrayBufferView and List<T>. | 109 # Typed arrays implement ArrayBufferView and List<T>. |
| 110 for parent in interface.parents: | 110 for parent in interface.parents: |
| 111 if parent.type.id == 'ArrayBufferView': | 111 if parent.type.id == 'ArrayBufferView': |
| 112 return MaybeListElementType(interface) | 112 return MaybeListElementType(interface) |
| 113 if parent.type.id == 'Uint8Array': | |
| 114 return 'int' | |
| 115 return None | 113 return None |
| 116 | 114 |
| 117 def MakeNativeSpec(javascript_binding_name): | 115 def MakeNativeSpec(javascript_binding_name): |
| 118 if javascript_binding_name in _frog_dom_custom_native_specs: | 116 if javascript_binding_name in _frog_dom_custom_native_specs: |
| 119 return _frog_dom_custom_native_specs[javascript_binding_name] | 117 return _frog_dom_custom_native_specs[javascript_binding_name] |
| 120 else: | 118 else: |
| 121 # Make the class 'hidden' so it is dynamically patched at runtime. This | 119 # Make the class 'hidden' so it is dynamically patched at runtime. This |
| 122 # is useful not only for browser compat, but to allow code that links | 120 # is useful not only for browser compat, but to allow code that links |
| 123 # against dart:dom to load in a worker isolate. | 121 # against dart:dom to load in a worker isolate. |
| 124 return '*' + javascript_binding_name | 122 return '*' + javascript_binding_name |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 '"SVGAnimatedListPropertyTearOff.h"', | 714 '"SVGAnimatedListPropertyTearOff.h"', |
| 717 '"SVGTransformListPropertyTearOff.h"', | 715 '"SVGTransformListPropertyTearOff.h"', |
| 718 '"SVGPathSegListPropertyTearOff.h"', | 716 '"SVGPathSegListPropertyTearOff.h"', |
| 719 ] | 717 ] |
| 720 | 718 |
| 721 def GetIDLTypeInfo(idl_type_name): | 719 def GetIDLTypeInfo(idl_type_name): |
| 722 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 720 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
| 723 if match: | 721 if match: |
| 724 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 722 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 725 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 723 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |