| 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 the system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 Dart:html APIs from the IDL database.""" | 7 Dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| 11 from generator import * | 11 from generator import * |
| 12 from htmldartgenerator import * | 12 from htmldartgenerator import * |
| 13 | 13 |
| 14 _js_custom_members = set([ | 14 _js_custom_members = set([ |
| 15 'ArrayBuffer.slice', | 15 'ArrayBuffer.slice', |
| 16 'AudioBufferSourceNode.start', | 16 'AudioBufferSourceNode.start', |
| 17 'AudioBufferSourceNode.stop', | 17 'AudioBufferSourceNode.stop', |
| 18 'AudioContext.createGain', | 18 'AudioContext.createGain', |
| 19 'AudioContext.createScriptProcessor', | 19 'AudioContext.createScriptProcessor', |
| 20 'CanvasRenderingContext2D.lineDashOffset', |
| 20 'Console.memory', | 21 'Console.memory', |
| 21 'Console.profiles', | 22 'Console.profiles', |
| 22 'Console.assertCondition', | 23 'Console.assertCondition', |
| 23 'Console.count', | 24 'Console.count', |
| 24 'Console.debug', | 25 'Console.debug', |
| 25 'Console.dir', | 26 'Console.dir', |
| 26 'Console.dirxml', | 27 'Console.dirxml', |
| 27 'Console.error', | 28 'Console.error', |
| 28 'Console.group', | 29 'Console.group', |
| 29 'Console.groupCollapsed', | 30 'Console.groupCollapsed', |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 | 926 |
| 926 self._members_emitter.Emit( | 927 self._members_emitter.Emit( |
| 927 ' $RENAME$ANNOTATIONS$MODIFIERS$TYPE$TARGET($PARAMS) native;\n', | 928 ' $RENAME$ANNOTATIONS$MODIFIERS$TYPE$TARGET($PARAMS) native;\n', |
| 928 RENAME=self._RenamingAnnotation(info.declared_name, target), | 929 RENAME=self._RenamingAnnotation(info.declared_name, target), |
| 929 ANNOTATIONS=self._Annotations(info.type_name, info.declared_name), | 930 ANNOTATIONS=self._Annotations(info.type_name, info.declared_name), |
| 930 MODIFIERS='static ' if info.IsStatic() else '', | 931 MODIFIERS='static ' if info.IsStatic() else '', |
| 931 TYPE=TypeOrNothing(native_return_type), | 932 TYPE=TypeOrNothing(native_return_type), |
| 932 TARGET=target, | 933 TARGET=target, |
| 933 PARAMS=', '.join(target_parameters)) | 934 PARAMS=', '.join(target_parameters)) |
| 934 | 935 |
| 935 declaration = '%s%s %s(%s)' % ( | 936 declaration = '%s%s%s %s(%s)' % ( |
| 937 self._Annotations(info.type_name, info.declared_name), |
| 936 'static ' if info.IsStatic() else '', | 938 'static ' if info.IsStatic() else '', |
| 937 return_type, | 939 return_type, |
| 938 html_name, | 940 html_name, |
| 939 info.ParametersDeclaration(InputType)) | 941 info.ParametersDeclaration(InputType)) |
| 940 self._GenerateDispatcherBody( | 942 self._GenerateDispatcherBody( |
| 941 operations, | 943 operations, |
| 942 parameter_names, | 944 parameter_names, |
| 943 declaration, | 945 declaration, |
| 944 GenerateCall, | 946 GenerateCall, |
| 945 self._IsOptional, | 947 self._IsOptional, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 for library_name in libraries: | 1109 for library_name in libraries: |
| 1108 self._libraries[library_name] = DartLibrary( | 1110 self._libraries[library_name] = DartLibrary( |
| 1109 library_name, template_loader, library_type, output_dir) | 1111 library_name, template_loader, library_type, output_dir) |
| 1110 | 1112 |
| 1111 def AddFile(self, basename, library_name, path): | 1113 def AddFile(self, basename, library_name, path): |
| 1112 self._libraries[library_name].AddFile(path) | 1114 self._libraries[library_name].AddFile(path) |
| 1113 | 1115 |
| 1114 def Emit(self, emitter, auxiliary_dir): | 1116 def Emit(self, emitter, auxiliary_dir): |
| 1115 for lib in self._libraries.values(): | 1117 for lib in self._libraries.values(): |
| 1116 lib.Emit(emitter, auxiliary_dir) | 1118 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |