~zorba-coders/zorba/bug900677

« back to all changes in this revision

Viewing changes to src/compiler/expression/fo_expr.cpp

  • Committer: Matthias Brantner
  • Date: 2012-05-11 20:51:10 UTC
  • mfrom: (10618.1.218 zorba)
  • Revision ID: matthias.brantner@28msec.com-20120511205110-vo9yjskbhrnd9w72
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "functions/udf.h"
28
28
 
29
29
#include "diagnostics/assert.h"
 
30
#include "diagnostics/util_macros.h"
 
31
 
 
32
#include "zorbaserialization/serialize_template_types.h"
 
33
#include "zorbaserialization/serialize_zorba_types.h"
 
34
 
30
35
 
31
36
namespace zorba
32
37
{
33
38
 
34
39
SERIALIZABLE_CLASS_VERSIONS(fo_expr)
35
 
END_SERIALIZABLE_CLASS_VERSIONS(fo_expr)
 
40
 
36
41
 
37
42
void fo_expr::accept(expr_visitor& v)
38
43
{
128
133
}
129
134
 
130
135
 
131
 
void fo_expr::serialize(::zorba::serialization::Archiver &ar)
 
136
void fo_expr::serialize(::zorba::serialization::Archiver& ar)
132
137
{
133
138
  serialize_baseclass(ar, (expr*)this);
134
139
  ar & theArgs;
135
 
  SERIALIZE_FUNCTION((function*&)theFunction);
 
140
  ar & ((function*&)theFunction);
136
141
}
137
142
 
138
143
 
153
158
  const function* func = get_func();
154
159
  csize numArgs = num_args();
155
160
 
156
 
  if (func->getKind() == FunctionConsts::OP_CONCATENATE_N)
 
161
  switch (func->getKind())
 
162
  {
 
163
  case FunctionConsts::OP_CONCATENATE_N:
157
164
  {
158
165
    bool vacuous = true;
159
166
 
175
182
      {
176
183
        if (is_updating() && !(argKind & UPDATING_EXPR) && argKind != VACUOUS_EXPR)
177
184
        {
178
 
          throw XQUERY_EXCEPTION(err::XUST0001,
179
 
                                 ERROR_PARAMS(ZED(XUST0001_CONCAT)),
180
 
                                 ERROR_LOC(theArgs[i]->get_loc()));
 
185
          RAISE_ERROR(err::XUST0001, theArgs[i]->get_loc(),
 
186
          ERROR_PARAMS(ZED(XUST0001_CONCAT)));
181
187
        }
182
188
        
183
189
        if (i > 0 && !is_updating() && !is_vacuous() && (argKind & UPDATING_EXPR))
184
190
        {
185
 
          throw XQUERY_EXCEPTION(err::XUST0001,
186
 
                                 ERROR_PARAMS(ZED(XUST0001_CONCAT)),
187
 
                                 ERROR_LOC(theArgs[i]->get_loc()));
 
191
          RAISE_ERROR(err::XUST0001, theArgs[i]->get_loc(),
 
192
          ERROR_PARAMS(ZED(XUST0001_CONCAT)));
188
193
        }
189
194
      }
190
195
 
201
206
      theScriptingKind &= ~SIMPLE_EXPR;
202
207
 
203
208
    checkScriptingKind();
204
 
  }
205
 
  else
 
209
 
 
210
    break;
 
211
  }
 
212
  case FunctionConsts::OP_HOIST_1:
 
213
  case FunctionConsts::OP_UNHOIST_1:
 
214
  {
 
215
    theScriptingKind = theArgs[0]->get_scripting_detail();
 
216
    break;
 
217
  }
 
218
  default:
206
219
  {
207
220
    theScriptingKind = func->getScriptingKind();
208
221
 
217
230
 
218
231
      if (arg->is_updating())
219
232
      {
220
 
        throw XQUERY_EXCEPTION(err::XUST0001,
221
 
                               ERROR_PARAMS(ZED(XUST0001_Generic)),
222
 
                               ERROR_LOC(theArgs[i]->get_loc()));
 
233
        RAISE_ERROR(err::XUST0001, theArgs[i]->get_loc(),
 
234
        ERROR_PARAMS(ZED(XUST0001_Generic)));
223
235
      }
224
236
 
225
237
      short argKind = arg->get_scripting_detail();
243
255
 
244
256
    checkScriptingKind();
245
257
  }
 
258
  }
246
259
}
247
260
 
248
261