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

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

Issue 446193002: Remove dart:blink dependency on dart:html. This CL moves all of the (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « sdk/lib/web_gl/dartium/web_gl_dartium.dart ('k') | tools/dom/scripts/systemnative.py » ('j') | 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 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 from generator import AnalyzeOperation, ConstantOutputOrder, \ 10 from generator import AnalyzeOperation, ConstantOutputOrder, \
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 431
432 def GenerateCall( 432 def GenerateCall(
433 stmts_emitter, call_emitter, version, signature_index, argument_count): 433 stmts_emitter, call_emitter, version, signature_index, argument_count):
434 generate_call( 434 generate_call(
435 stmts_emitter, call_emitter, 435 stmts_emitter, call_emitter,
436 version, operations[signature_index], argument_count) 436 version, operations[signature_index], argument_count)
437 437
438 def IsOptional(signature_index, argument): 438 def IsOptional(signature_index, argument):
439 return is_optional(operations[signature_index], argument) 439 return is_optional(operations[signature_index], argument)
440 440
441 emitter = \ 441 emitter = self._members_emitter
442 self._native_class_emitter if self._dart_use_blink \
443 else self._members_emitter
444 442
445 self._GenerateOverloadDispatcher( 443 self._GenerateOverloadDispatcher(
446 info, 444 info,
447 [operation.arguments for operation in operations], 445 [operation.arguments for operation in operations],
448 operations[0].type.id == 'void', 446 operations[0].type.id == 'void',
449 declaration, 447 declaration,
450 GenerateCall, 448 GenerateCall,
451 IsOptional, 449 IsOptional,
452 emitter, 450 emitter,
453 can_omit_type_check) 451 can_omit_type_check)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 else: 540 else:
543 custom_factory_ctr = self._interface.id in _custom_factories 541 custom_factory_ctr = self._interface.id in _custom_factories
544 constructor_full_name = constructor_info._ConstructorFullName( 542 constructor_full_name = constructor_info._ConstructorFullName(
545 self._DartType) 543 self._DartType)
546 544
547 def GenerateCall( 545 def GenerateCall(
548 stmts_emitter, call_emitter, 546 stmts_emitter, call_emitter,
549 version, signature_index, argument_count): 547 version, signature_index, argument_count):
550 name = emitter.Format('_create_$VERSION', VERSION=version) 548 name = emitter.Format('_create_$VERSION', VERSION=version)
551 if self._dart_use_blink: 549 if self._dart_use_blink:
552 qualified_name = self.DeriveNativeName(name + 'constructorCallback') 550 base_name = \
551 self.DeriveNativeName(name + 'constructorCallback')
552 qualified_name = \
553 self.DeriveQualifiedBlinkName(self._interface.id,
554 base_name)
553 else: 555 else:
554 qualified_name = emitter.Format( 556 qualified_name = emitter.Format(
555 '$FACTORY.$NAME', 557 '$FACTORY.$NAME',
556 FACTORY=factory_name, 558 FACTORY=factory_name,
557 NAME=name) 559 NAME=name)
558 call_emitter.Emit('$FACTORY_NAME($FACTORY_PARAMS)', 560 call_emitter.Emit('$FACTORY_NAME($FACTORY_PARAMS)',
559 FACTORY_NAME=qualified_name, 561 FACTORY_NAME=qualified_name,
560 FACTORY_PARAMS= \ 562 FACTORY_PARAMS= \
561 constructor_info.ParametersAsArgumentList(argument_count)) 563 constructor_info.ParametersAsArgumentList(argument_count))
562 self.EmitStaticFactoryOverload( 564 self.EmitStaticFactoryOverload(
563 constructor_info, name, 565 constructor_info, name,
564 constructor_info.idl_args[signature_index][:argument_count]) 566 constructor_info.idl_args[signature_index][:argument_count])
565 567
566 def IsOptional(signature_index, argument): 568 def IsOptional(signature_index, argument):
567 return self.IsConstructorArgumentOptional(argument) 569 return self.IsConstructorArgumentOptional(argument)
568 570
569 entry_declaration = emitter.Format( 571 entry_declaration = emitter.Format(
570 '$(METADATA)$FACTORY_KEYWORD $CTOR($PARAMS)', 572 '$(METADATA)$FACTORY_KEYWORD $CTOR($PARAMS)',
571 FACTORY_KEYWORD=('factory' if not custom_factory_ctr else 573 FACTORY_KEYWORD=('factory' if not custom_factory_ctr else
572 'static %s' % constructor_full_name), 574 'static %s' % constructor_full_name),
573 CTOR=(('' if not custom_factory_ctr else '_factory') 575 CTOR=(('' if not custom_factory_ctr else '_factory')
574 + constructor_full_name), 576 + constructor_full_name),
575 METADATA=metadata, 577 METADATA=metadata,
576 PARAMS=constructor_info.ParametersAsDeclaration(self._DartType)) 578 PARAMS=constructor_info.ParametersAsDeclaration(self._DartType))
577 579
578 if self._dart_use_blink: 580 overload_emitter = self._members_emitter
579 overload_emitter = self._native_class_emitter 581 overload_declaration = entry_declaration
580 mname = constructor_full_name.replace(".", "_")
581 blink_name = "$mk" + mname
582 qual_name = self.DeriveQualifiedBlinkName(
583 self._interface.id, blink_name)
584 actuals_s = constructor_info.ParametersAsStringOfVariables()
585 self._members_emitter.Emit(
586 '\n'
587 ' $DECLARATION => $NATIVE_NAME($ACTUALS);\n',
588 DECLARATION=entry_declaration,
589 NATIVE_NAME=qual_name,
590 ACTUALS=actuals_s)
591 overload_declaration = emitter.Format(
592 '// Generated overload resolver\n'
593 ' static $CTOR($PARAMS)',
594 CTOR=blink_name,
595 PARAMS=actuals_s)
596
597
598 else:
599 overload_emitter = self._members_emitter
600 overload_declaration = entry_declaration
601 582
602 self._GenerateOverloadDispatcher( 583 self._GenerateOverloadDispatcher(
603 constructor_info, 584 constructor_info,
604 constructor_info.idl_args, 585 constructor_info.idl_args,
605 False, 586 False,
606 overload_declaration, 587 overload_declaration,
607 GenerateCall, 588 GenerateCall,
608 IsOptional, 589 IsOptional,
609 overload_emitter) 590 overload_emitter)
610 591
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 return self._type_registry.TypeInfo(type_name).narrow_dart_type() 739 return self._type_registry.TypeInfo(type_name).narrow_dart_type()
759 740
760 def _NarrowInputType(self, type_name): 741 def _NarrowInputType(self, type_name):
761 return self._NarrowToImplementationType(type_name) 742 return self._NarrowToImplementationType(type_name)
762 743
763 def _DartType(self, type_name): 744 def _DartType(self, type_name):
764 return self._type_registry.DartType(type_name) 745 return self._type_registry.DartType(type_name)
765 746
766 def _TypeInfo(self, type_name): 747 def _TypeInfo(self, type_name):
767 return self._type_registry.TypeInfo(type_name) 748 return self._type_registry.TypeInfo(type_name)
OLDNEW
« no previous file with comments | « sdk/lib/web_gl/dartium/web_gl_dartium.dart ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698