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

Unified Diff: sky/engine/bindings-dart/dart/scripts/templates/interface_cpp.template

Issue 918273002: Remove bindings-dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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-dart/dart/scripts/templates/interface_cpp.template
diff --git a/sky/engine/bindings-dart/dart/scripts/templates/interface_cpp.template b/sky/engine/bindings-dart/dart/scripts/templates/interface_cpp.template
deleted file mode 100644
index e41f73e5d76bd508f2b12c793b5527c3cb35c54c..0000000000000000000000000000000000000000
--- a/sky/engine/bindings-dart/dart/scripts/templates/interface_cpp.template
+++ /dev/null
@@ -1,167 +0,0 @@
-{% extends 'interface_base_cpp.template' %}
-
-
-{# TODO(terry): Implement setter and deleter too #}
-
-
-{##############################################################################}
-{% block indexed_property_getter %}
-{% if indexed_property_getter and not indexed_property_getter.is_custom %}
- {% set getter = indexed_property_getter %}
-static void indexedPropertyGetter(Dart_NativeArguments args)
-{
- {{cpp_class}}* /* FIXME(vsm): Remove this. */ ALLOW_UNUSED receiver = DartDOMWrapper::receiver< {{cpp_class}} >(args);
- Dart_Handle exception = 0;
- {
- {% if indexed_property_getter.is_raises_exception %}
- DartExceptionState es;
- {% endif %}
-
- {# TODO(terry): Assume index is unsigned long, which all currently are. #}
- unsigned index = DartUtilities::dartToUnsigned(args, 1, exception);
- if (exception)
- goto fail;
- {{indexed_property_getter.cpp_type}} result = {{indexed_property_getter.cpp_value}};
- if (!result)
- return;
- {{indexed_property_getter.dart_set_return_value}};
-
- return;
- }
-
-fail:
- Dart_ThrowException(exception);
- ASSERT_NOT_REACHED();
-}
-
-{% endif %}
-{# TODO(terry): Should handle custom index getter - none today. #}
-{% endblock %}
-
-
-{##############################################################################}
-{% block indexed_property_getter_resolver %}
- {# TODO(terry): Support all indexed and named properties today only indexed getter is supported. #}
- {# Resolver indexed properties #}
- {% if indexed_property_getter and not indexed_property_getter.is_custom %}
- {% for native_entry in indexed_property_getter.native_entries %}
- {% set resolver_string = native_entry.resolver_string %}
-if (argumentCount == 2 && name == "{{resolver_string}}") {
- *autoSetupScope = true;
- return {{dart_class}}Internal::indexedPropertyGetter;
-}
- {% endfor %}
- {% endif %}
-{% endblock %}
-
-{##############################################################################}
-{% block named_property_getter_resolver %}
- {# Resolver named properties #}
- {% if named_property_getter %}
- {% for native_entry in named_property_getter.native_entries %}
- {% set resolver_string = native_entry.resolver_string %}
-if (argumentCount == 2 && (name == "{{resolver_string}}")) {
- *autoSetupScope = true;
- return {{dart_class}}Internal::propertyQuery;
-}
- {% endfor %}
- {% endif %}
-{% endblock %}
-
-{##############################################################################}
-{% block generate_symbolizer_indexed_property_getter %}
- {% if indexed_property_getter and not indexed_property_getter.is_custom %}
- {% for native_entry in indexed_property_getter.native_entries %}
- {% set resolver_string = native_entry.resolver_string %}
-if (nf == {{dart_class}}Internal::indexedPropertyGetter) {
- return reinterpret_cast<const uint8_t*>("{{resolver_string}}");
-}
- {% endfor %}
- {% endif %}
-{% endblock %}
-
-{##############################################################################}
-{% block generate_symbolizer_named_property_getter %}
- {# Resolver named properties #}
- {% if named_property_getter %}
- {% for native_entry in named_property_getter.native_entries %}
- {% set resolver_string = native_entry.resolver_string %}
-if (nf == {{dart_class}}Internal::propertyQuery) {
- return reinterpret_cast<const uint8_t*>("{{resolver_string}}");
-}
- {% endfor %}
- {% endif %}
-{% endblock %}
-
-{##############################################################################}
-{% block to_dart_no_inline %}
-template<>
-Dart_Handle toDartNoInline({{cpp_class}}* impl, DartDOMData* domData)
-{
- return {{dart_class}}::toDart(impl);
-}
-{% endblock %}
-
-{% from 'methods_cpp.template' import static_method_name with context %}
-
-{##############################################################################}
-{% block overloaded_constructor %}
-{% if constructor_overloads %}
-static void constructorCallbackDispatcher(Dart_NativeArguments args)
-{
- Dart_Handle exception = 0;
- const int argOffset = 0;
- int argCount = Dart_GetNativeArgumentCount(args) + argOffset;
- {# 2. Initialize argcount to be min(maxarg, n). #}
- switch (std::min({{constructor_overloads.maxarg}}, argCount)) {
- {# 3. Remove from S all entries whose type list is not of length argcount. #}
- {% for length, tests_constructors in constructor_overloads.length_tests_methods %}
- case {{length}}:
- {# Then resolve by testing argument #}
- {% for test, constructor in tests_constructors %}
- {# 10. If i = d, then: #}
- if ({{test}}) {
- {% if constructor.is_custom %}
- {{static_method_name(constructor.name)}}(args);
- {% else %}
- {{static_method_name(constructor.name, constructor.overload_index)}}(args);
- {% endif %}
- return;
- }
- {% endfor %}
- break;
- {% endfor %}
- default:
- {# Invalid arity, throw error #}
- {# Report full list of valid arities if gaps and above minimum #}
- {% if constructor_overloads.valid_arities %}
- if (argCount >= {{overloads.minarg}}) {
- const String message = "Wrong arity, expected one of {{constructor_overloads.valid_arities}}";
- exception = DartUtilities::coreArgumentErrorException(message);
- goto fail;
- }
- {% endif %}
- {# Otherwise just report "not enough arguments" #}
- {
- const String message = "Not enough arguments (at least {{constructor_overloads.minarg}} required)";
- exception = DartUtilities::coreArgumentErrorException(message);
- goto fail;
- }
- return;
- }
- {# No match, throw error #}
- {
- const String message = "No matching constructor signature.";
- exception = DartUtilities::coreArgumentErrorException(message);
- goto fail;
- }
- return;
-fail:
- Dart_ThrowException(exception);
- ASSERT_NOT_REACHED();
-}
-{% endif %}
-{% endblock %}
-
-
-{##############################################################################}

Powered by Google App Engine
This is Rietveld 408576698