this repo has no description
at develop 960 B view raw
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 3/* 4 * Main authors: 5 * Guido Tack <guido.tack@monash.edu> 6 */ 7 8/* This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 11 12#include <minizinc/flat_exp.hh> 13 14namespace MiniZinc { 15 16EE flatten_anon(EnvI& env, const Ctx& ctx, Expression* e, VarDecl* r, VarDecl* b) { 17 CallStackItem _csi(env, e); 18 EE ret; 19 auto* av = e->cast<AnonVar>(); 20 if (av->type().isbot()) { 21 throw InternalError("type of anonymous variable could not be inferred"); 22 } 23 GCLock lock; 24 VarDecl* vd = new_vardecl(env, Ctx(), new TypeInst(Location().introduce(), av->type()), nullptr, 25 nullptr, nullptr); 26 ret.b = bind(env, Ctx(), b, constants().literalTrue); 27 ret.r = bind(env, ctx, r, vd->id()); 28 return ret; 29} 30 31} // namespace MiniZinc