From 7d93dae8ea6428fecc5e8039d77d4bbc671ed610 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 4 Jun 2010 20:10:46 +0200 Subject: [PATCH] fix some simple problems (but doesn't pass tests yet) looks like a logic error: new advice::Request got solution --- src/lib/advice/binding.cpp | 6 ++++-- src/lib/advice/binding.hpp | 5 ++--- src/lib/advice/index.hpp | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib/advice/binding.cpp b/src/lib/advice/binding.cpp index 4a8d35d29..c123f04d7 100644 --- a/src/lib/advice/binding.cpp +++ b/src/lib/advice/binding.cpp @@ -23,6 +23,7 @@ #include "lib/advice/binding.hpp" #include "lib/symbol.hpp" +#include "lib/util.hpp" #include #include @@ -30,6 +31,7 @@ using lib::Literal; +using util::isnil; using boost::regex; using boost::smatch; @@ -102,8 +104,8 @@ namespace advice { Binding::Binding (Literal spec) { - REQUIRE (spec); - parse_and_append (spec); + if (!isnil(spec)) + parse_and_append (spec); } diff --git a/src/lib/advice/binding.hpp b/src/lib/advice/binding.hpp index 9d5ef0f80..23d2b5ae4 100644 --- a/src/lib/advice/binding.hpp +++ b/src/lib/advice/binding.hpp @@ -63,9 +63,8 @@ ** could be fed as parameters to the bound advice. But this extension requires to extend ** the simple hash-based match check to an actual unification of the patterns. ///TICKET #615 ** - ** @see configrules.hpp - ** @see typed-lookup.cpp corresponding implementation - ** @see typed-id-test.cpp + ** @see advice.hpp + ** @see advice-binding-pattern-test.cpp ** */ diff --git a/src/lib/advice/index.hpp b/src/lib/advice/index.hpp index a4bb7addd..610f793a1 100644 --- a/src/lib/advice/index.hpp +++ b/src/lib/advice/index.hpp @@ -214,12 +214,12 @@ namespace advice { overwrite (POA const& oldRef, POA& newElm) { EIter pos = std::find (elms_.begin(),elms_.end(), oldRef); - REQUIRE (pos!=elms_.end(), "Attempt to overwrite an entry which isn't there."); - REQUIRE (!contains (newElm), "Duplicate entry"); + REQUIRE (pos!=elms_.end(), "Attempt to overwrite an entry which isn't there."); + REQUIRE_IF (&oldRef != &newElm, !contains (newElm), "Duplicate entry"); *pos = Entry(newElm); - ENSURE (!contains (oldRef), "Duplicate entry"); + REQUIRE_IF (&oldRef != &newElm, !contains (oldRef), "Duplicate entry"); } void