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

Unified Diff: Source/bindings/templates/attributes.cpp

Issue 351403003: IDL: Merge duplicating local variable assignment in attribute_getter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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: Source/bindings/templates/attributes.cpp
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
index e7393c1a409ff84431f950c7336801b24634aa35..2a9cfc87f9f3e028fa004d3ea2839b90a10a64f6 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -48,13 +48,8 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% if attribute.is_nullable and not attribute.has_type_checking_nullable %}
bool isNull = false;
{% endif %}
- {# FIXME: consider always using a local variable for value #}
- {% if attribute.cached_attribute_validation_method or
- attribute.is_getter_raises_exception or
- attribute.is_nullable or
- attribute.reflect_only or
- attribute.idl_type == 'EventHandler' %}
- {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
+ {% if attribute.cpp_value_original %}
+ {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_original}});
{% endif %}
{# Checks #}
{% if attribute.is_getter_raises_exception %}
@@ -89,11 +84,9 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% endif %}
{# v8SetReturnValue #}
{% if attribute.is_keep_alive_for_gc %}
- {# FIXME: merge local variable assignment with above #}
- {{attribute.cpp_type}} result({{attribute.cpp_value}});
- if (result && DOMDataStore::setReturnValueFromWrapper{{world_suffix}}<{{attribute.v8_type}}>(info.GetReturnValue(), result.get()))
+ if ({{attribute.cpp_value}} && DOMDataStore::setReturnValueFromWrapper{{world_suffix}}<{{attribute.v8_type}}>(info.GetReturnValue(), {{attribute.cpp_value}}.get()))
return;
- v8::Handle<v8::Value> wrapper = toV8(result.get(), holder, info.GetIsolate());
+ v8::Handle<v8::Value> wrapper = toV8({{attribute.cpp_value}}.get(), holder, info.GetIsolate());
if (!wrapper.IsEmpty()) {
V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "{{attribute.name}}"), wrapper);
{{attribute.v8_set_return_value}};

Powered by Google App Engine
This is Rietveld 408576698