Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: client/dom/scripts/dartgenerator.py

Issue 9346008: Remove vestigial constructors in Frog implementation classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 generates Dart APIs from the IDL database.""" 6 """This module generates Dart APIs from the IDL database."""
7 7
8 import emitter 8 import emitter
9 import idlnode 9 import idlnode
10 import logging 10 import logging
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 _idl_to_dart_type_conversions.iteritems()) 59 _idl_to_dart_type_conversions.iteritems())
60 60
61 61
62 # 62 #
63 # Identifiers that are used in the IDL than need to be treated specially because 63 # Identifiers that are used in the IDL than need to be treated specially because
64 # *some* JavaScript processors forbid them as properties. 64 # *some* JavaScript processors forbid them as properties.
65 # 65 #
66 _javascript_keywords = ['delete', 'continue'] 66 _javascript_keywords = ['delete', 'continue']
67 67
68 # 68 #
69 # Types with user-invocable constructors. We do not have enough
70 # information in IDL to create the signature.
71 #
72 # Each entry is of the form:
73 # type name: constructor parameters
74 _constructable_types = {
75 'AudioContext': '',
76 'FileReader': '',
77 'XMLHttpRequest': '',
78 'WebKitCSSMatrix': '[String spec]',
79 'WebKitPoint': 'num x, num y',
80 'WebSocket': 'String url',
81 # dart:html types
82 'CSSMatrix': '[String spec]',
83 'Point': 'num x, num y',
84 }
85
86 #
87 # Interface version of the DOM needs to delegate typed array constructors to a 69 # Interface version of the DOM needs to delegate typed array constructors to a
88 # factory provider. 70 # factory provider.
89 # 71 #
90 _interface_factories = { 72 _interface_factories = {
91 'Float32Array': '_TypedArrayFactoryProvider', 73 'Float32Array': '_TypedArrayFactoryProvider',
92 'Float64Array': '_TypedArrayFactoryProvider', 74 'Float64Array': '_TypedArrayFactoryProvider',
93 'Int8Array': '_TypedArrayFactoryProvider', 75 'Int8Array': '_TypedArrayFactoryProvider',
94 'Int16Array': '_TypedArrayFactoryProvider', 76 'Int16Array': '_TypedArrayFactoryProvider',
95 'Int32Array': '_TypedArrayFactoryProvider', 77 'Int32Array': '_TypedArrayFactoryProvider',
96 'Uint8Array': '_TypedArrayFactoryProvider', 78 'Uint8Array': '_TypedArrayFactoryProvider',
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 self._members_emitter = self._dart_code.Emit( 1907 self._members_emitter = self._dart_code.Emit(
1926 self._template, 1908 self._template,
1927 #class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 1909 #class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
1928 #$!MEMBERS 1910 #$!MEMBERS
1929 #} 1911 #}
1930 CLASSNAME=self._class_name, 1912 CLASSNAME=self._class_name,
1931 EXTENDS=extends, 1913 EXTENDS=extends,
1932 IMPLEMENTS=' implements ' + ', '.join(implements), 1914 IMPLEMENTS=' implements ' + ', '.join(implements),
1933 NATIVESPEC=' native "' + native_spec + '"') 1915 NATIVESPEC=' native "' + native_spec + '"')
1934 1916
1935 if interface_name in _constructable_types:
1936 self._members_emitter.Emit(
1937 ' $NAME($PARAMS) native;\n\n',
1938 NAME=interface_name,
1939 PARAMS=_constructable_types[interface_name])
1940
1941 element_type = MaybeTypedArrayElementType(interface) 1917 element_type = MaybeTypedArrayElementType(interface)
1942 if element_type: 1918 if element_type:
1943 self.AddTypedArrayConstructors(element_type) 1919 self.AddTypedArrayConstructors(element_type)
1944 1920
1945 1921
1946 def FinishInterface(self): 1922 def FinishInterface(self):
1947 """.""" 1923 """."""
1948 pass 1924 pass
1949 1925
1950 def _ImplClassName(self, type_name): 1926 def _ImplClassName(self, type_name):
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 INDENT=indent, 2290 INDENT=indent,
2315 NATIVENAME=native_name, 2291 NATIVENAME=native_name,
2316 ARGS=argument_expressions) 2292 ARGS=argument_expressions)
2317 2293
2318 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native ' 2294 self._members_emitter.Emit(' $TYPE $NATIVE_NAME($PARAMS) native '
2319 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n', 2295 '"$(INTERFACE)$(NATIVE_NAME)_Callback";\n',
2320 NATIVE_NAME=native_name, 2296 NATIVE_NAME=native_name,
2321 TYPE=info.type_name, 2297 TYPE=info.type_name,
2322 PARAMS=', '.join(arg_names), 2298 PARAMS=', '.join(arg_names),
2323 INTERFACE=self._interface.id) 2299 INTERFACE=self._interface.id)
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/XMLHttpRequest.dart ('k') | client/dom/src/_FactoryProviders.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698