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

Side by Side Diff: tools/dom/scripts/systemnative.py

Issue 14150007: Drop raises annotations support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« no previous file with comments | « tools/dom/scripts/idlrenderer.py ('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) 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr) 351 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr)
352 self._GenerateNativeCallback( 352 self._GenerateNativeCallback(
353 cpp_callback_name, 353 cpp_callback_name,
354 True, 354 True,
355 function_expression, 355 function_expression,
356 attr, 356 attr,
357 [], 357 [],
358 attr.type.id, 358 attr.type.id,
359 attr.type.nullable, 359 attr.type.nullable,
360 attr.get_raises or 'GetterRaisesException' in attr.ext_attrs) 360 'GetterRaisesException' in attr.ext_attrs)
361 361
362 def _AddSetter(self, attr, html_name): 362 def _AddSetter(self, attr, html_name):
363 type_info = self._TypeInfo(attr.type.id) 363 type_info = self._TypeInfo(attr.type.id)
364 dart_declaration = 'void set %s(%s value)' % (html_name, self._DartType(attr .type.id)) 364 dart_declaration = 'void set %s(%s value)' % (html_name, self._DartType(attr .type.id))
365 is_custom = set(['Custom', 'CustomSetter', 'V8CustomSetter']) & set(attr.ext _attrs) 365 is_custom = set(['Custom', 'CustomSetter', 'V8CustomSetter']) & set(attr.ext _attrs)
366 cpp_callback_name = self._GenerateNativeBinding(attr.id, 2, 366 cpp_callback_name = self._GenerateNativeBinding(attr.id, 2,
367 dart_declaration, 'Setter', is_custom) 367 dart_declaration, 'Setter', is_custom)
368 if is_custom: 368 if is_custom:
369 return 369 return
370 370
371 if 'Reflect' in attr.ext_attrs: 371 if 'Reflect' in attr.ext_attrs:
372 webcore_function_name = self._TypeInfo(attr.type.id).webcore_setter_name() 372 webcore_function_name = self._TypeInfo(attr.type.id).webcore_setter_name()
373 else: 373 else:
374 webcore_function_name = re.sub(r'^(xml(?=[A-Z])|\w)', 374 webcore_function_name = re.sub(r'^(xml(?=[A-Z])|\w)',
375 lambda s: s.group(1).upper(), 375 lambda s: s.group(1).upper(),
376 attr.id) 376 attr.id)
377 webcore_function_name = 'set%s' % webcore_function_name 377 webcore_function_name = 'set%s' % webcore_function_name
378 if attr.type.id.startswith('SVGAnimated'): 378 if attr.type.id.startswith('SVGAnimated'):
379 webcore_function_name += 'Animated' 379 webcore_function_name += 'Animated'
380 380
381 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr) 381 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr)
382 self._GenerateNativeCallback( 382 self._GenerateNativeCallback(
383 cpp_callback_name, 383 cpp_callback_name,
384 True, 384 True,
385 function_expression, 385 function_expression,
386 attr, 386 attr,
387 [attr], 387 [attr],
388 'void', 388 'void',
389 False, 389 False,
390 attr.set_raises or 'SetterRaisesException' in attr.ext_attrs) 390 'SetterRaisesException' in attr.ext_attrs)
391 391
392 def AddIndexer(self, element_type): 392 def AddIndexer(self, element_type):
393 """Adds all the methods required to complete implementation of List.""" 393 """Adds all the methods required to complete implementation of List."""
394 # We would like to simply inherit the implementation of everything except 394 # We would like to simply inherit the implementation of everything except
395 # length, [], and maybe []=. It is possible to extend from a base 395 # length, [], and maybe []=. It is possible to extend from a base
396 # array implementation class only when there is no other implementation 396 # array implementation class only when there is no other implementation
397 # inheritance. There might be no implementation inheritance other than 397 # inheritance. There might be no implementation inheritance other than
398 # DOMBaseWrapper for many classes, but there might be some where the 398 # DOMBaseWrapper for many classes, but there might be some where the
399 # array-ness is introduced by a non-root interface: 399 # array-ness is introduced by a non-root interface:
400 # 400 #
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d) 524 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d)
525 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, operation) 525 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, operation)
526 self._GenerateNativeCallback( 526 self._GenerateNativeCallback(
527 cpp_callback_name, 527 cpp_callback_name,
528 not operation.is_static, 528 not operation.is_static,
529 function_expression, 529 function_expression,
530 operation, 530 operation,
531 arguments, 531 arguments,
532 operation.type.id, 532 operation.type.id,
533 operation.type.nullable, 533 operation.type.nullable,
534 operation.raises or 'RaisesException' in operation.ext_attrs) 534 'RaisesException' in operation.ext_attrs)
535 535
536 def _GenerateNativeCallback(self, 536 def _GenerateNativeCallback(self,
537 callback_name, 537 callback_name,
538 needs_receiver, 538 needs_receiver,
539 function_expression, 539 function_expression,
540 node, 540 node,
541 arguments, 541 arguments,
542 return_type, 542 return_type,
543 return_type_is_nullable, 543 return_type_is_nullable,
544 raises_dom_exception): 544 raises_dom_exception):
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 917 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
918 ' return func;\n', 918 ' return func;\n',
919 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 919 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
920 920
921 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 921 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
922 return ( 922 return (
923 interface.id.endswith('Event') and 923 interface.id.endswith('Event') and
924 operation.id.startswith('init') and 924 operation.id.startswith('init') and
925 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and 925 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and
926 argument.type.id == 'DOMString') 926 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/scripts/idlrenderer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698