Indenting fixes in Kotlin template
This is in preparation for CL "Generalize JNI type logic in macros"
which for some reason triggers assertions in generator_lib.py
preprocess caused by *existing* indenting issues in the template.
generator_lib wants all content in a nested jinja2 block to have a
greater indention, which I can work around without an extra indention
for the C block by closing the scope on the same line as the next {%
elif %} etc.
It doesn't recognise {% if .. %} etc if there's a newline inside the
tag.
Change-Id: Id3a8eb3aeb29dbac9e562df285dd1a1331eee0a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/195294
Commit-Queue: Jim Blackler <jimblackler@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/templates/art/methods.cpp b/generator/templates/art/methods.cpp
index 496189b..5548cdd 100644
--- a/generator/templates/art/methods.cpp
+++ b/generator/templates/art/methods.cpp
@@ -142,7 +142,7 @@
{{ as_varName(arg.name) }} =
reinterpret_cast<{{ as_cType(arg.type.name) }}*>(
env->GetIntArrayElements(_{{ as_varName(arg.name) }}, 0));
- {{ arg.length.name.camelCase() }} =
+ {{ arg.length.name.camelCase() }} =
env->GetArrayLength(_{{ as_varName(arg.name) }});
{% elif arg.type.name.get() == 'void' %}
{{ as_varName(arg.name) }} =
@@ -162,8 +162,7 @@
out[idx] = static_cast<{{ as_cType(arg.type.name) }}>(
env->CallIntMethod(element, getValue));
}
- }
- {% elif arg.type.category == 'object' %} {
+ } {% elif arg.type.category == 'object' %} {
jclass memberClass = env->FindClass("{{ jni_name(arg.type) }}");
jmethodID getHandle = env->GetMethodID(memberClass, "getHandle", "()J");
for (int idx = 0; idx != length; idx++) {
@@ -172,14 +171,12 @@
out[idx] = reinterpret_cast<{{ as_cType(arg.type.name) }}>(
env->CallLongMethod(element, getHandle));
}
- }
- {% else %}
+ } {% else %}
{{ unreachable_code() }}
{% endif %}
{{ as_varName(arg.name) }} = out;
{{ arg.length.name.camelCase() }} = length;
- }
- {% endif %}
+ } {% endif %}
//* Single value types.
{% elif arg.type.category == 'object' %}
@@ -192,8 +189,7 @@
} else {
{{ as_varName(arg.name) }} = nullptr;
}
- {% elif arg.type.name.get() in ['int32_t', 'size_t', 'uint32_t', 'uint64_t']
- or arg.type.category in ['bitmask', 'enum'] %}
+ {% elif arg.type.name.get() in ['int32_t', 'size_t', 'uint32_t', 'uint64_t'] or arg.type.category in ['bitmask', 'enum'] %}
{{ as_varName(arg.name) }} =
static_cast<{{ as_cType(arg.type.name) }}>(_{{ as_varName(arg.name) }});
{% elif arg.type.name.get() in ['float', 'int'] %}
@@ -250,8 +246,7 @@
//* TODO(b/330293719): free associated resources.
userdata = new UserData(
{.env = env, .callback = env->NewGlobalRef(_{{ as_varName(arg.name) }})});
- }
- {% else %}
+ } {% else %}
{{ unreachable_code() }}
{% endif %}
{% endfor %}
@@ -288,8 +283,7 @@
{% elif method.return_type.name.get() != 'void' %}
return result; //* Primitives are implicitly converted by JNI.
{% endif %}
-}
-{% endmacro %}
+} {% endmacro %}
{% for obj in by_category['object'] %}
{% for method in obj.methods if include_method(method) %}