| 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 systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 e.Emit('namespace WebCore {\n'); | 1201 e.Emit('namespace WebCore {\n'); |
| 1202 e.Emit('\n'); | 1202 e.Emit('\n'); |
| 1203 e.Emit('enum {\n'); | 1203 e.Emit('enum {\n'); |
| 1204 e.Emit(' _InvalidClassId = 0,\n'); | 1204 e.Emit(' _InvalidClassId = 0,\n'); |
| 1205 e.Emit(' _HistoryCrossFrameClassId,\n'); | 1205 e.Emit(' _HistoryCrossFrameClassId,\n'); |
| 1206 e.Emit(' _LocationCrossFrameClassId,\n'); | 1206 e.Emit(' _LocationCrossFrameClassId,\n'); |
| 1207 e.Emit(' _DOMWindowCrossFrameClassId,\n'); | 1207 e.Emit(' _DOMWindowCrossFrameClassId,\n'); |
| 1208 e.Emit(' _DateTimeClassId,\n'); | 1208 e.Emit(' _DateTimeClassId,\n'); |
| 1209 e.Emit(' _JsObjectClassId,\n'); | 1209 e.Emit(' _JsObjectClassId,\n'); |
| 1210 e.Emit(' _JsFunctionClassId,\n'); | 1210 e.Emit(' _JsFunctionClassId,\n'); |
| 1211 e.Emit(' _JsArrayClassId,\n'); |
| 1211 e.Emit(' // New types that are not auto-generated should be added here.\n
'); | 1212 e.Emit(' // New types that are not auto-generated should be added here.\n
'); |
| 1212 e.Emit('\n'); | 1213 e.Emit('\n'); |
| 1213 for interface in database.GetInterfaces(): | 1214 for interface in database.GetInterfaces(): |
| 1214 interface_name = interface.id | 1215 interface_name = interface.id |
| 1215 e.Emit(' %sClassId,\n' % interface_name) | 1216 e.Emit(' %sClassId,\n' % interface_name) |
| 1216 e.Emit(' NumWebkitClassIds\n'); | 1217 e.Emit(' NumWebkitClassIds\n'); |
| 1217 e.Emit('};\n'); | 1218 e.Emit('};\n'); |
| 1218 | 1219 |
| 1219 e.Emit('typedef struct {\n'); | 1220 e.Emit('typedef struct {\n'); |
| 1220 e.Emit(' const char* class_name;\n'); | 1221 e.Emit(' const char* class_name;\n'); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1247 e.Emit('namespace WebCore {\n'); | 1248 e.Emit('namespace WebCore {\n'); |
| 1248 e.Emit('\n'); | 1249 e.Emit('\n'); |
| 1249 e.Emit("_DartWebkitClassInfo DartWebkitClassInfo = {\n"); | 1250 e.Emit("_DartWebkitClassInfo DartWebkitClassInfo = {\n"); |
| 1250 e.Emit(' { "_InvalidClassId", -1, -1, false, false, false },\n'); | 1251 e.Emit(' { "_InvalidClassId", -1, -1, false, false, false },\n'); |
| 1251 e.Emit(' { "_HistoryCrossFrame", DartHtmlLibraryId, -1, false, false, fal
se },\n'); | 1252 e.Emit(' { "_HistoryCrossFrame", DartHtmlLibraryId, -1, false, false, fal
se },\n'); |
| 1252 e.Emit(' { "_LocationCrossFrame", DartHtmlLibraryId, -1, false, false, fa
lse },\n'); | 1253 e.Emit(' { "_LocationCrossFrame", DartHtmlLibraryId, -1, false, false, fa
lse },\n'); |
| 1253 e.Emit(' { "_DOMWindowCrossFrame", DartHtmlLibraryId, -1, false, false, t
rue },\n'); | 1254 e.Emit(' { "_DOMWindowCrossFrame", DartHtmlLibraryId, -1, false, false, t
rue },\n'); |
| 1254 e.Emit(' { "DateTime", DartCoreLibraryId, -1, false, false, false },\n'); | 1255 e.Emit(' { "DateTime", DartCoreLibraryId, -1, false, false, false },\n'); |
| 1255 e.Emit(' { "JsObject", DartJsLibraryId, -1, false, false, false },\n'); | 1256 e.Emit(' { "JsObject", DartJsLibraryId, -1, false, false, false },\n'); |
| 1256 e.Emit(' { "JsFunction", DartJsLibraryId, _JsObjectClassId, false, false,
false },\n'); | 1257 e.Emit(' { "JsFunction", DartJsLibraryId, _JsObjectClassId, false, false,
false },\n'); |
| 1258 e.Emit(' { "JsArray", DartJsLibraryId, _JsObjectClassId, false, false, fa
lse },\n'); |
| 1257 e.Emit(' // New types that are not auto-generated should be added here.\n
'); | 1259 e.Emit(' // New types that are not auto-generated should be added here.\n
'); |
| 1258 e.Emit('\n'); | 1260 e.Emit('\n'); |
| 1259 is_node_test = lambda interface: interface.id == 'Node' | 1261 is_node_test = lambda interface: interface.id == 'Node' |
| 1260 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs | 1262 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs |
| 1261 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr
s | 1263 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr
s |
| 1262 def TypeCheckHelper(test): | 1264 def TypeCheckHelper(test): |
| 1263 return 'true' if any(map(test, database.Hierarchy(interface))) else 'false
' | 1265 return 'true' if any(map(test, database.Hierarchy(interface))) else 'false
' |
| 1264 for interface in database.GetInterfaces(): | 1266 for interface in database.GetInterfaces(): |
| 1265 e.Emit(" {") | 1267 e.Emit(" {") |
| 1266 type_info = type_registry.TypeInfo(interface.id) | 1268 type_info = type_registry.TypeInfo(interface.id) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1280 e.Emit('\n'); | 1282 e.Emit('\n'); |
| 1281 e.Emit('} // namespace WebCore\n'); | 1283 e.Emit('} // namespace WebCore\n'); |
| 1282 self._emitters.Flush() | 1284 self._emitters.Flush() |
| 1283 | 1285 |
| 1284 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1286 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1285 return ( | 1287 return ( |
| 1286 interface.id.endswith('Event') and | 1288 interface.id.endswith('Event') and |
| 1287 operation.id.startswith('init') and | 1289 operation.id.startswith('init') and |
| 1288 argument.ext_attrs.get('Default') == 'Undefined' and | 1290 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1289 argument.type.id == 'DOMString') | 1291 argument.type.id == 'DOMString') |
| OLD | NEW |