Bump to C++11. Add default functions to Scope() constructor.

This commit is contained in:
Brandon Amos
2016-07-10 13:31:12 -04:00
parent 21eb0d7f99
commit cb8865efb2
3 changed files with 4 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ SRC=$(EXE).cpp shunting-yard.cpp packToken.cpp functions.cpp catch.cpp
OBJ=$(SRC:.cpp=.o)
CXX=g++
CFLAGS=-g -Wall -pedantic #-DDEBUG
CFLAGS=-std=c++0x -g -Wall -pedantic #-DDEBUG
all: $(EXE)
$(EXE): $(OBJ); $(CXX) $(CFLAGS) $(OBJ) -o $(EXE)

View File

@@ -40,8 +40,8 @@ struct Scope {
typedef std::list<TokenMap_t*> Scope_t;
mutable Scope_t scope;
Scope() {}
Scope(TokenMap_t* vars);
Scope() : Scope(0) {}
packToken* find(std::string key) const;
void asign(std::string key, TokenBase* value) const;

View File

@@ -131,6 +131,8 @@ TEST_CASE("Scope management") {
scope.pop();
scope.pop();
scope.pop(); // Final pop for default functions.
// Test what happens when you try to drop more namespaces than possible:
REQUIRE_THROWS(scope.pop());