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

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

Issue 8473008: Generate constants for IDL classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add frog dom 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/XPathResult.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 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 ' String get typeName() native;\n') 1946 ' String get typeName() native;\n')
1947 1947
1948 def _ImplClassName(self, type_name): 1948 def _ImplClassName(self, type_name):
1949 return type_name 1949 return type_name
1950 1950
1951 def FinishInterface(self): 1951 def FinishInterface(self):
1952 """.""" 1952 """."""
1953 pass 1953 pass
1954 1954
1955 def AddConstant(self, constant): 1955 def AddConstant(self, constant):
1956 # Since we are currently generating native classes without interfaces,
1957 # generate the constants as part of the class. This will need to go away
1958 # if we revert back to generating interfaces.
1959 self._members_emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n',
1960 NAME=constant.id,
1961 TYPE=constant.type.id,
1962 VALUE=constant.value)
1963
1956 pass 1964 pass
1957 1965
1958 def AddGetter(self, attr): 1966 def AddGetter(self, attr):
1959 # Declare as a field in the native class. 1967 # Declare as a field in the native class.
1960 # TODO(vsm): Mark this as native somehow. 1968 # TODO(vsm): Mark this as native somehow.
1961 self._members_emitter.Emit( 1969 self._members_emitter.Emit(
1962 '\n' 1970 '\n'
1963 ' $TYPE $NAME;\n', 1971 ' $TYPE $NAME;\n',
1964 NAME=attr.id, TYPE=attr.type.id, INTERFACE=self._interface.id) 1972 NAME=attr.id, TYPE=attr.type.id, INTERFACE=self._interface.id)
1965 1973
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 Arguments: 2021 Arguments:
2014 info: An OperationInfo object. 2022 info: An OperationInfo object.
2015 """ 2023 """
2016 # TODO(vsm): Handle overloads. 2024 # TODO(vsm): Handle overloads.
2017 self._members_emitter.Emit( 2025 self._members_emitter.Emit(
2018 '\n' 2026 '\n'
2019 ' $TYPE $NAME($ARGS) native;\n', 2027 ' $TYPE $NAME($ARGS) native;\n',
2020 TYPE=info.type_name, 2028 TYPE=info.type_name,
2021 NAME=info.name, 2029 NAME=info.name,
2022 ARGS=info.arg_implementation_declaration) 2030 ARGS=info.arg_implementation_declaration)
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/XPathResult.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698