| 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 copy | 9 import copy |
| 10 import re | 10 import re |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 def MakeNativeSpec(javascript_binding_name): | 154 def MakeNativeSpec(javascript_binding_name): |
| 155 if javascript_binding_name in _frog_dom_custom_native_specs: | 155 if javascript_binding_name in _frog_dom_custom_native_specs: |
| 156 return _frog_dom_custom_native_specs[javascript_binding_name] | 156 return _frog_dom_custom_native_specs[javascript_binding_name] |
| 157 else: | 157 else: |
| 158 # Make the class 'hidden' so it is dynamically patched at runtime. This | 158 # Make the class 'hidden' so it is dynamically patched at runtime. This |
| 159 # is useful not only for browser compat, but to allow code that links | 159 # is useful not only for browser compat, but to allow code that links |
| 160 # against dart:dom_deprecated to load in a worker isolate. | 160 # against dart:dom_deprecated to load in a worker isolate. |
| 161 return '*' + javascript_binding_name | 161 return '*' + javascript_binding_name |
| 162 | 162 |
| 163 | 163 |
| 164 def MatchSourceFilter(filter, thing): | 164 def MatchSourceFilter(thing): |
| 165 if not filter: | 165 return 'WebKit' in thing.annotations or 'Dart' in thing.annotations |
| 166 return True | |
| 167 else: | |
| 168 return any(token in thing.annotations for token in filter) | |
| 169 | 166 |
| 170 | 167 |
| 171 def DartType(idl_type_name): | 168 def DartType(idl_type_name): |
| 172 return GetIDLTypeInfo(idl_type_name).dart_type() | 169 return GetIDLTypeInfo(idl_type_name).dart_type() |
| 173 | 170 |
| 174 | 171 |
| 175 class ParamInfo(object): | 172 class ParamInfo(object): |
| 176 """Holder for various information about a parameter of a Dart operation. | 173 """Holder for various information about a parameter of a Dart operation. |
| 177 | 174 |
| 178 Attributes: | 175 Attributes: |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 836 |
| 840 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 837 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
| 841 if match: | 838 if match: |
| 842 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 839 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 843 | 840 |
| 844 match = re.match(r'(\w+)\[\]$', idl_type_name) | 841 match = re.match(r'(\w+)\[\]$', idl_type_name) |
| 845 if match: | 842 if match: |
| 846 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 843 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 847 | 844 |
| 848 return IDLTypeInfo(idl_type_name) | 845 return IDLTypeInfo(idl_type_name) |
| OLD | NEW |