OLD | NEW |
1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
2 | 2 |
3 | 3 |
4 {##############################################################################} | 4 {##############################################################################} |
5 {% macro attribute_configuration(attribute) %} | 5 {% macro attribute_configuration(attribute) %} |
6 {% set getter_callback = | 6 {% set getter_callback = |
7 '%sV8Internal::%sAttributeGetterCallback' % | 7 '%sV8Internal::%sAttributeGetterCallback' % |
8 (cpp_class, attribute.name) | 8 (cpp_class, attribute.name) |
9 if not attribute.constructor_type else | 9 if not attribute.constructor_type else |
10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} | 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 {##############################################################################} | 131 {##############################################################################} |
132 {% from 'methods.cpp' import generate_argument %} | 132 {% from 'methods.cpp' import generate_argument %} |
133 {% block constructor %} | 133 {% block constructor %} |
134 {% if has_constructor %} | 134 {% if has_constructor %} |
135 {# FIXME: support overloading #} | 135 {# FIXME: support overloading #} |
136 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 136 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
137 { | 137 { |
138 {% if constructor_arguments %} | 138 {% if constructor_arguments %} |
139 {# FIXME: support optional arguments #} | 139 {# FIXME: support optional arguments #} |
140 {% set number_of_arguments = constructor_arguments|length %} | 140 {% set number_of_arguments = constructor_arguments|length %} |
141 {# FIXME: remove this UNLIKELY: constructors are heavy, so no difference. #} | 141 if (info.Length() < {{number_of_arguments}}) { |
142 if (UNLIKELY(info.Length() < {{number_of_arguments}})) { | |
143 throwTypeError(ExceptionMessages::failedToExecute("Constructor", "{{inte
rface_name}}", ExceptionMessages::notEnoughArguments({{number_of_arguments}}, in
fo.Length())), info.GetIsolate()); | 142 throwTypeError(ExceptionMessages::failedToExecute("Constructor", "{{inte
rface_name}}", ExceptionMessages::notEnoughArguments({{number_of_arguments}}, in
fo.Length())), info.GetIsolate()); |
144 return; | 143 return; |
145 } | 144 } |
146 {% endif %} | 145 {% endif %} |
147 {% if is_constructor_raises_exception %} | 146 {% if is_constructor_raises_exception %} |
148 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf
ace_name}}", info.Holder(), info.GetIsolate()); | 147 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf
ace_name}}", info.Holder(), info.GetIsolate()); |
149 {% endif %} | 148 {% endif %} |
150 {% for argument in constructor_arguments %} | 149 {% for argument in constructor_arguments %} |
151 {{generate_argument(constructor_method, argument) | indent}} | 150 {{generate_argument(constructor_method, argument) | indent}} |
152 {% endfor %} | 151 {% endfor %} |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 fromInternalPointer(object)->deref(); | 688 fromInternalPointer(object)->deref(); |
690 } | 689 } |
691 | 690 |
692 template<> | 691 template<> |
693 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 692 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
694 { | 693 { |
695 return toV8(impl, creationContext, isolate); | 694 return toV8(impl, creationContext, isolate); |
696 } | 695 } |
697 | 696 |
698 {% endblock %} | 697 {% endblock %} |
OLD | NEW |