Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/bug-923015 into
lp:zorba.
Requested reviews:
Matthias Brantner (matthias-brantner)
William Candillon (wcandillon)
Related bugs:
Bug #923015 in Zorba: clone() not implemented for full-text expressions
https://bugs.launchpad.net/zorba/+bug/923015
For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/bug-923015/+merge/92398
Added clone().
--
https://code.launchpad.net/~paul-lucas/zorba/bug-923015/+merge/92398
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-02-07 14:26:42 +
+++ ChangeLog 2012-02-10 01:03:24 +
@@ -2,6 +2,7 @@
version 2.2
+ * Fixed bug 923015 (clone() not implemented for full-text expressions)
* No-copy optimization: avoids copying nodes during node-constructor expressions.
* Added external function annotations %ann:propagates-input-nodes and
%ann:must-copy-input-nodes to be used by the no-copy optimization.
=== modified file 'src/compiler/expression/ft_expr.cpp'
--- src/compiler/expression/ft_expr.cpp 2011-06-14 17:26:33 +
+++ src/compiler/expression/ft_expr.cpp 2012-02-10 01:03:24 +
@@ -58,6 +58,15 @@
v.end_visit( *this );
}
+expr_t ftcontains_expr::clone( substitution_t s ) const {
+ return new ftcontains_expr(
+theSctx, get_loc(),
+range_-clone( s ),
+ftselection_-clone( s ).release(),
+ftignore_.isNull() ? 0 : ftignore_-clone( s )
+ );
+}
+
void ftcontains_expr::compute_scripting_kind() {
checkSimpleExpr(range_);
=== modified file 'src/compiler/expression/ft_expr.h'
--- src/compiler/expression/ft_expr.h 2012-01-11 17:30:25 +
+++ src/compiler/expression/ft_expr.h 2012-02-10 01:03:24 +
@@ -37,13 +37,14 @@
void serialize( serialization::Archiver );
ftcontains_expr(
-static_context* sctx,
+static_context*,
QueryLoc const,
expr_t range,
ftnode *ftselection,
expr_t ftignore
);
+ expr_t clone( substitution_t ) const;
void compute_scripting_kind();
expr_t get_range() const { return range_; }
@@ -63,7 +64,6 @@
} // namespace zorba
#endif /* ZORBA_FT_EXPR_H */
-
/*
* Local variables:
* mode: c++
=== modified file 'src/compiler/expression/ftnode.cpp'
--- src/compiler/expression/ftnode.cpp 2012-02-02 09:56:52 +
+++ src/compiler/expression/ftnode.cpp 2012-02-10 01:03:24 +
@@ -30,6 +30,7 @@
#include ftnode_visitor.h
using namespace std;
+using namespace zorba::locale;
namespace zorba {
@@ -199,6 +200,37 @@
///
+templatetypename PointerType
+inline PointerType clone_ptr( PointerType p, expr::substitution_t s ) {
+ return static_castPointerType( p-clone( s ).release() );
+}
+
+templateclass RCHandleValueType
+inline RCHandleValueType* clone_ptr( rchandleRCHandleValueType const p,
+ expr::substitution_t s ) {
+ return static_castRCHandleValueType*( p-clone( s ).release() );
+}
+
+templatetypename PointerType
+inline PointerType clone_ptr_if( PointerType p, expr::substitution_t s ) {
+ return p ? clone_ptr( p, s ) : nullptr;
+}
+
+templateclass RCHandleValueType
+inline RCHandleValueType* clone_ptr_if( rchandleRCHandleValueType const p,
+expr::substitution_t s ) {
+ return p.isNull() ? nullptr : clone_ptr( p, s );
+}
+
+templateclass ContainerType
+void clone_list( ContainerType const from, ContainerType *to,
+ expr::substitution_t s ) {
+ FOR_EACH( typename ContainerType, i, from )
+to-push_back( clone_ptr( *i, s ) );
+}
+
+///
+
void ftnode::serialize( serialization::Archiver ar ) {
ar loc_;
}
@@ -214,6 +246,12 @@
END_VISIT( v );
}
+ftnode_t ftand::clone( expr::substitution_t s ) const {
+ ftnode_list_t copy;
+ clone_list( get_node_list(), copy, s );
+ return new ftand( get_loc(), copy );
+}
+
ostream ftand::put( ostream o ) const {
BEGIN_INDENT_PUT( o, ftand );
PUT_SEQ( o, ftnode_list_t, get_node_list() );
@@ -238,6 +276,10 @@
END_VISIT( v );
}
+ftnode_t ftcase_option::clone( expr::substitution_t ) const {
+ return new ftcase_option( get_loc(), mode_ );
+}
+
ostream ftcase_option::put( ostream o ) const {
BEGIN_PUT( o, ftcase_option );
PUT_ATTR( o, mode ) endl;
@@ -262,6 +304,10 @@
END_VISIT( v );
}
+ftnode_t ftcontent_filter::clone( expr::substitution_t s ) const {
+ return new ftcontent_filter( get_loc(), mode_ );
+}
+
void ftcontent_filter::serialize( serialization::Archiver ar ) {
serialize_baseclass( ar, (ftpos_filter*)this );
SERIALIZE_ENUM(ft_content_mode::type, mode_);
@@ -287,6 +333,10 @@
END_VISIT( v );
}
+ftnode_t ftdiacritics_option::clone( expr::substitution_t ) const {
+ return new ftdiacritics_option( get_loc(), mode_ );
+}
+
ostream ftdiacritics_option::put( ostream o ) const {
BEGIN_PUT(