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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 # Decorate the singleton Console object, if present (workers do not have a | 61 # Decorate the singleton Console object, if present (workers do not have a |
62 # console). | 62 # console). |
63 'Console': "=(typeof console == 'undefined' ? {} : console)", | 63 'Console': "=(typeof console == 'undefined' ? {} : console)", |
64 | 64 |
65 # DOMWindow aliased with global scope. | 65 # DOMWindow aliased with global scope. |
66 'DOMWindow': '@*DOMWindow', | 66 'DOMWindow': '@*DOMWindow', |
67 } | 67 } |
68 | 68 |
69 # | 69 # |
70 # Custom native bodies for frog implementations of dom operations that appear in | 70 # Custom native bodies for frog implementations of dom operations that appear in |
71 # dart:dom and dart:html. This is used to work-around the lack of a 'rename' | 71 # dart:dom_deprecated and dart:html. This is used to work-around the lack of a
'rename' |
72 # feature in the 'native' string - the correct name is available on the DartName | 72 # feature in the 'native' string - the correct name is available on the DartName |
73 # extended attribute. See Issue 1814 | 73 # extended attribute. See Issue 1814 |
74 # | 74 # |
75 dom_frog_native_bodies = { | 75 dom_frog_native_bodies = { |
76 # Some JavaScript processors, especially tools like yuicompress and | 76 # Some JavaScript processors, especially tools like yuicompress and |
77 # JSCompiler, choke on 'this.continue' | 77 # JSCompiler, choke on 'this.continue' |
78 'IDBCursor.continueFunction': | 78 'IDBCursor.continueFunction': |
79 """ | 79 """ |
80 if (key == null) return this['continue'](); | 80 if (key == null) return this['continue'](); |
81 return this['continue'](key); | 81 return this['continue'](key); |
(...skipping 29 matching lines...) Expand all Loading... |
111 if parent.type.id == 'ArrayBufferView': | 111 if parent.type.id == 'ArrayBufferView': |
112 return MaybeListElementType(interface) | 112 return MaybeListElementType(interface) |
113 return None | 113 return None |
114 | 114 |
115 def MakeNativeSpec(javascript_binding_name): | 115 def MakeNativeSpec(javascript_binding_name): |
116 if javascript_binding_name in _frog_dom_custom_native_specs: | 116 if javascript_binding_name in _frog_dom_custom_native_specs: |
117 return _frog_dom_custom_native_specs[javascript_binding_name] | 117 return _frog_dom_custom_native_specs[javascript_binding_name] |
118 else: | 118 else: |
119 # 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 |
120 # 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 |
121 # against dart:dom to load in a worker isolate. | 121 # against dart:dom_deprecated to load in a worker isolate. |
122 return '*' + javascript_binding_name | 122 return '*' + javascript_binding_name |
123 | 123 |
124 | 124 |
125 def MatchSourceFilter(filter, thing): | 125 def MatchSourceFilter(filter, thing): |
126 if not filter: | 126 if not filter: |
127 return True | 127 return True |
128 else: | 128 else: |
129 return any(token in thing.annotations for token in filter) | 129 return any(token in thing.annotations for token in filter) |
130 | 130 |
131 | 131 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 '"SVGAnimatedListPropertyTearOff.h"', | 719 '"SVGAnimatedListPropertyTearOff.h"', |
720 '"SVGTransformListPropertyTearOff.h"', | 720 '"SVGTransformListPropertyTearOff.h"', |
721 '"SVGPathSegListPropertyTearOff.h"', | 721 '"SVGPathSegListPropertyTearOff.h"', |
722 ] | 722 ] |
723 | 723 |
724 def GetIDLTypeInfo(idl_type_name): | 724 def GetIDLTypeInfo(idl_type_name): |
725 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 725 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
726 if match: | 726 if match: |
727 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 727 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
728 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 728 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
OLD | NEW |