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

Unified Diff: sky/engine/bindings/scripts/templates/methods_cpp.template

Issue 936193005: Make it possible to inherit from any constructable host object (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove extra comment Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: sky/engine/bindings/scripts/templates/methods_cpp.template
diff --git a/sky/engine/bindings/scripts/templates/methods_cpp.template b/sky/engine/bindings/scripts/templates/methods_cpp.template
index aac59cd3b93159251450096d09fee9866e659823..aa32f392b27e921d47d6dec7f5ec222b24e98813 100644
--- a/sky/engine/bindings/scripts/templates/methods_cpp.template
+++ b/sky/engine/bindings/scripts/templates/methods_cpp.template
@@ -335,7 +335,7 @@ static void {{static_method_name(constructor.name, overload_index)}}(Dart_Native
ExceptionState es;
{% endif %}
{{generate_arguments(constructor) | indent(8)}}
- {{callback_return(constructor, constructor.dart_set_return_value, constructor.cpp_value) | indent(8)}}
+ {{constructor.cpp_value}}->AssociateWithDartWrapper(args);
{% if constructor.has_exception_state %}
if (es.had_exception()) {
exception = es.GetDartException(args, {{constructor.auto_scope}});
@@ -368,6 +368,8 @@ static void eventConstructorCallback(Dart_NativeArguments args)
{% macro generate_resolver_constructor(dart_class, class_name, constructor) %}
{% for native_entry in constructor.native_entries %}
{% set resolver_string = native_entry.resolver_string %}
+{% set args_one_based = constructor.number_of_arguments + 1 %}
+{% set args_required_one_based = constructor.number_of_required_arguments + 1 %}
{% if constructor.overload_index %}
{% set constructor_name = static_method_name(constructor.name) + "Dispatcher" %}
{% else %}
@@ -376,9 +378,9 @@ static void eventConstructorCallback(Dart_NativeArguments args)
{% if has_custom_constructor %}
if (name == "{{resolver_string}}") {
{% elif constructor.number_of_arguments == constructor.number_of_required_arguments %}
-if (argumentCount == {{constructor.number_of_arguments}} && name == "{{resolver_string}}") {
+if (argumentCount == {{args_one_based}} && name == "{{resolver_string}}") {
{% else %}
-if (argumentCount >= {{constructor.number_of_required_arguments}} && argumentCount <= {{constructor.number_of_arguments}} && name == "{{resolver_string}}") {
+if (argumentCount >= {{args_required_one_based}} && argumentCount <= {{args_one_based}} && name == "{{resolver_string}}") {
{% endif %}
*autoSetupScope = {{constructor.auto_scope}};
return {{dart_class}}Internal::{{constructor_name}};

Powered by Google App Engine
This is Rietveld 408576698