Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/hof-merge into lp:zorba.
Commit message: Some runtime code restructuring: 1. moved runtime/function_item/ to runtime/hof 2. renamed function_item_iter files to fn_hof_functions files 3. split function_item.h to function_item.h and function_item_iter.h (and same for the .cpp file) 4. Renamed DynamicFunctioniterator to FunctionItemIterator 5. Renamed DynamicFunctionInfo to FunctionItemInfo Requested reviews: Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/hof-merge/+merge/155144 Some runtime code restructuring: 1. moved runtime/function_item/ to runtime/hof 2. renamed function_item_iter files to fn_hof_functions files 3. split function_item.h to function_item.h and function_item_iter.h (and same for the .cpp file) 4. Renamed DynamicFunctioniterator to FunctionItemIterator 5. Renamed DynamicFunctionInfo to FunctionItemInfo -- https://code.launchpad.net/~zorba-coders/zorba/hof-merge/+merge/155144 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/codegen/plan_visitor.cpp' --- src/compiler/codegen/plan_visitor.cpp 2013-03-17 13:55:28 +0000 +++ src/compiler/codegen/plan_visitor.cpp 2013-03-24 15:29:24 +0000 @@ -483,7 +483,8 @@ fnInfo->theScopedVarsIterators.push_back(pop_itstack()); } - std::reverse(fnInfo->theScopedVarsIterators.begin(), fnInfo->theScopedVarsIterators.end()); + std::reverse(fnInfo->theScopedVarsIterators.begin(), + fnInfo->theScopedVarsIterators.end()); } @@ -494,10 +495,10 @@ for (csize i = 0; i < numOuterVars; ++i) { var_expr* ve = theCCB->theEM->create_var_expr(fnInfo->theClosureSctx, - NULL, - qloc, - var_expr::hof_var, - fnInfo->theScopedVarsNames[i].getp()); + NULL, + qloc, + var_expr::hof_var, + fnInfo->theScopedVarsNames[i].getp()); if (!fnInfo->theIsGlobalVar[i]) { === modified file 'src/compiler/expression/expr_clone.cpp' --- src/compiler/expression/expr_clone.cpp 2013-03-23 15:23:57 +0000 +++ src/compiler/expression/expr_clone.cpp 2013-03-24 15:29:24 +0000 @@ -387,7 +387,6 @@ udf, get_loc(), e->theDynamicFunctionInfo->theFunction, - e->theDynamicFunctionInfo->theFunction->getName(), e->theDynamicFunctionInfo->theArity, e->is_inline(), e->needs_context_item(), === modified file 'src/compiler/expression/expr_manager.cpp' --- src/compiler/expression/expr_manager.cpp 2013-03-23 15:20:54 +0000 +++ src/compiler/expression/expr_manager.cpp 2013-03-24 15:29:24 +0000 @@ -813,14 +813,13 @@ user_function* udf, const QueryLoc& loc, function* f, - store::Item* qname, uint32_t arity, bool isInline, bool needsContextItem, bool isCoercion) { CREATE_AND_RETURN_EXPR(function_item_expr, sctx, udf, loc, - f, qname, arity, isInline, needsContextItem, isCoercion); + f, arity, isInline, needsContextItem, isCoercion); } === modified file 'src/compiler/expression/expr_manager.h' --- src/compiler/expression/expr_manager.h 2013-03-23 15:20:54 +0000 +++ src/compiler/expression/expr_manager.h 2013-03-24 15:29:24 +0000 @@ -493,7 +493,6 @@ user_function* udf, const QueryLoc& loc, function* f, - store::Item* qname, uint32_t arity, bool isInline, bool needsContextItem, === modified file 'src/compiler/expression/expr_type.cpp' --- src/compiler/expression/expr_type.cpp 2013-03-16 08:48:16 +0000 +++ src/compiler/expression/expr_type.cpp 2013-03-24 15:29:24 +0000 @@ -653,12 +653,15 @@ case function_item_expr_kind: { theType = rtm.ANY_FUNCTION_TYPE_ONE; + function_item_expr* fiExpr = static_cast<function_item_expr*>(this); + if (fiExpr->get_function() != NULL) { const xqtref_t& retType = fiExpr->get_function()->getSignature().returnType(); + std::vector<xqtref_t> paramTypes; - for (csize i=0; i<fiExpr->get_function()->getSignature().paramCount(); i++ ) + for (csize i = 0; i < fiExpr->get_function()->getSignature().paramCount(); ++i) paramTypes.push_back(fiExpr->get_function()->getSignature()[i]); theType = new FunctionXQType(&rtm, paramTypes, retType, TypeConstants::QUANT_ONE); === modified file 'src/compiler/expression/function_item_expr.cpp' --- src/compiler/expression/function_item_expr.cpp 2013-03-23 15:20:54 +0000 +++ src/compiler/expression/function_item_expr.cpp 2013-03-24 15:29:24 +0000 @@ -89,8 +89,7 @@ user_function* udf, const QueryLoc& loc, function* f, - store::Item* qname, - uint32_t arity, + csize arity, bool isInline, bool needsContextItem, bool isCoercion) @@ -99,7 +98,7 @@ theDynamicFunctionInfo(new DynamicFunctionInfo(sctx, loc, f, - qname, + f->getName(), arity, isInline, needsContextItem, @@ -128,7 +127,7 @@ needsContextItem, isCoercion)) { - theScriptingKind = SIMPLE_EXPR; + compute_scripting_kind(); } @@ -137,6 +136,13 @@ } +void function_item_expr::compute_scripting_kind() +{ + // ???? TODO + theScriptingKind = SIMPLE_EXPR; +} + + void function_item_expr::add_variable( expr* var, var_expr* substVar, @@ -156,13 +162,6 @@ } -void function_item_expr::compute_scripting_kind() -{ - // ???? TODO - theScriptingKind = SIMPLE_EXPR; -} - - store::Item_t function_item_expr::create_inline_fname(const QueryLoc& loc) { store::Item_t name; @@ -175,7 +174,7 @@ } -DEF_EXPR_ACCEPT (function_item_expr); +DEF_EXPR_ACCEPT(function_item_expr); }//end of namespace === modified file 'src/compiler/expression/function_item_expr.h' --- src/compiler/expression/function_item_expr.h 2013-03-23 15:20:54 +0000 +++ src/compiler/expression/function_item_expr.h 2013-03-24 15:29:24 +0000 @@ -134,8 +134,7 @@ user_function* udf, const QueryLoc& loc, function* f, - store::Item* aQName, - uint32_t aArity, + uint32_t arity, bool isInline, bool needsContextItem, bool isCoercion); === modified file 'src/compiler/translator/translator.cpp' --- src/compiler/translator/translator.cpp 2013-03-23 15:20:54 +0000 +++ src/compiler/translator/translator.cpp 2013-03-24 15:29:24 +0000 @@ -11931,7 +11931,6 @@ expr* fiExpr = CREATE(function_item)(theRootSctx, theUDF, loc, f, - f->getName(), arity, false, // not inline needs_context_item, @@ -11961,39 +11960,6 @@ push_nodestack(fiExpr); - // Translate the return tyoe - xqtref_t returnType = theRTM.ITEM_TYPE_STAR; - if (v.getReturnType() != 0) - { - v.getReturnType()->accept(*this); - returnType = pop_tstack(); - } - - // Translate the type declarations for the function params - rchandle<ParamList> params = v.getParamList(); - std::vector<xqtref_t> paramTypes; - - if (params != 0) - { - std::vector<rchandle<Param> >::const_iterator lIt = params->begin(); - for(; lIt != params->end(); ++lIt) - { - const Param* param = lIt->getp(); - const SequenceType* paramType = param->get_typedecl(); - if (paramType == 0) - { - paramTypes.push_back(theRTM.ITEM_TYPE_STAR); - } - else - { - paramType->accept(*this); - paramTypes.push_back(pop_tstack()); - } - } - } - - flwor_expr* flwor = NULL; - // Handle function parameters. Translation of the params, if any, results to // a flwor expr with one let binding for each function parameter: // @@ -12002,6 +11968,8 @@ // let $xN as TN := _xN // // where each _xi is an arg var. + rchandle<ParamList> params = v.getParamList(); + flwor_expr* flwor = NULL; if (params) { params->accept(*this); @@ -12012,8 +11980,7 @@ flwor = CREATE(flwor)(theRootSctx, theUDF, loc, false); } - // Handle inscope variables. For each inscope var, a let binding is added to - // the flwor. + // Handle inscope variables. std::vector<VarInfo*>::iterator ite = scopedVars.begin(); for(; ite != scopedVars.end(); ++ite) @@ -12042,16 +12009,14 @@ else throw; } + + fiExpr->add_variable(varExpr, subst_var, varExpr->get_name(), 0); } else { subst_var = varExpr; + fiExpr->add_variable(NULL, subst_var, varExpr->get_name(), 1); } - - if (kind == var_expr::prolog_var) - fiExpr->add_variable(NULL, subst_var, varExpr->get_name(), 1 /*var is global if it's a prolog var*/); - else - fiExpr->add_variable(varExpr, subst_var, varExpr->get_name(), 0); } if (flwor->num_clauses() > 0) === modified file 'src/runtime/function_item/function_item.cpp' --- src/runtime/function_item/function_item.cpp 2013-03-23 15:20:54 +0000 +++ src/runtime/function_item/function_item.cpp 2013-03-24 15:29:24 +0000 @@ -127,6 +127,7 @@ { theScopedVarsValues.push_back(var); theSubstVarsValues.push_back(substVar); + theScopedVarsNames.push_back(name); theIsGlobalVar.push_back(isGlobal); theVarId.push_back(0);
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp