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

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

Issue 8773024: Mark frog DOMWindow as aliased with global scope. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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
« no previous file with comments | « client/dom/generated/src/frog/DOMWindow.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, 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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 extends = " extends " + base 1921 extends = " extends " + base
1922 else: 1922 else:
1923 extends = "" 1923 extends = ""
1924 1924
1925 if interface_name in _constructable_types.keys(): 1925 if interface_name in _constructable_types.keys():
1926 parameters = _constructable_types[interface_name] 1926 parameters = _constructable_types[interface_name]
1927 constructor = ' %s(%s) native;\n\n' % (interface_name, parameters) 1927 constructor = ' %s(%s) native;\n\n' % (interface_name, parameters)
1928 else: 1928 else:
1929 constructor = '' 1929 constructor = ''
1930 1930
1931 # Compiler needs to know window is aliased with global scope.
1932 global_marker = '@' if interface_name == 'DOMWindow' else ''
1933
1931 (self._members_emitter, self._base_emitter) = self._dart_code.Emit( 1934 (self._members_emitter, self._base_emitter) = self._dart_code.Emit(
1932 '\n' 1935 '\n'
1933 'class $CLASS$BASE native "*$CLASS" {\n' 1936 'class $CLASS$BASE native "$SPLAT*$CLASS" {\n'
1934 '$CONSTRUCTOR$!MEMBERS' 1937 '$CONSTRUCTOR$!MEMBERS'
1935 '$!ADDITIONS' 1938 '$!ADDITIONS'
1936 '}\n', 1939 '}\n',
1937 CLASS=self._class_name, BASE=extends, 1940 CLASS=self._class_name, BASE=extends,
1938 INTERFACE=interface_name, CONSTRUCTOR=constructor) 1941 INTERFACE=interface_name, CONSTRUCTOR=constructor,
1942 SPLAT=global_marker)
1939 1943
1940 if not base: 1944 if not base:
1941 # Emit shared base functionality here as we have no common base type. 1945 # Emit shared base functionality here as we have no common base type.
1942 self._base_emitter.Emit( 1946 self._base_emitter.Emit(
1943 '\n' 1947 '\n'
1944 ' var dartObjectLocalStorage;\n' 1948 ' var dartObjectLocalStorage;\n'
1945 '\n' 1949 '\n'
1946 ' String get typeName() native;\n') 1950 ' String get typeName() native;\n')
1947 1951
1948 def _ImplClassName(self, type_name): 1952 def _ImplClassName(self, type_name):
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 Arguments: 2025 Arguments:
2022 info: An OperationInfo object. 2026 info: An OperationInfo object.
2023 """ 2027 """
2024 # TODO(vsm): Handle overloads. 2028 # TODO(vsm): Handle overloads.
2025 self._members_emitter.Emit( 2029 self._members_emitter.Emit(
2026 '\n' 2030 '\n'
2027 ' $TYPE $NAME($ARGS) native;\n', 2031 ' $TYPE $NAME($ARGS) native;\n',
2028 TYPE=info.type_name, 2032 TYPE=info.type_name,
2029 NAME=info.name, 2033 NAME=info.name,
2030 ARGS=info.arg_implementation_declaration) 2034 ARGS=info.arg_implementation_declaration)
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/DOMWindow.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698