Skip to content

Commit

Permalink
Fixed C-API function name, resolved #87, thanks @hiperiondev
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratstail91 committed Jul 25, 2023
1 parent 24ce965 commit ba98624
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions repl/lib_about.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int Toy_hookAbout(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lite
//store as an aliased dictionary
if (!TOY_IS_NULL(alias)) {
//make sure the name isn't taken
if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) {
if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) {
interpreter->errorOutput("Can't override an existing variable\n");
Toy_freeLiteral(alias);

Expand Down Expand Up @@ -83,11 +83,11 @@ int Toy_hookAbout(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lite
//store globally
else {
//make sure the names aren't taken
if (Toy_isDelcaredScopeVariable(interpreter->scope, majorKeyLiteral) ||
Toy_isDelcaredScopeVariable(interpreter->scope, minorKeyLiteral) ||
Toy_isDelcaredScopeVariable(interpreter->scope, patchKeyLiteral) ||
Toy_isDelcaredScopeVariable(interpreter->scope, buildKeyLiteral) ||
Toy_isDelcaredScopeVariable(interpreter->scope, authorKeyLiteral)) {
if (Toy_isDeclaredScopeVariable(interpreter->scope, majorKeyLiteral) ||
Toy_isDeclaredScopeVariable(interpreter->scope, minorKeyLiteral) ||
Toy_isDeclaredScopeVariable(interpreter->scope, patchKeyLiteral) ||
Toy_isDeclaredScopeVariable(interpreter->scope, buildKeyLiteral) ||
Toy_isDeclaredScopeVariable(interpreter->scope, authorKeyLiteral)) {
interpreter->errorOutput("Can't override an existing variable\n");
Toy_freeLiteral(alias);

Expand Down
2 changes: 1 addition & 1 deletion repl/lib_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ int Toy_hookRandom(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lit
//store the library in an aliased dictionary
if (!TOY_IS_NULL(alias)) {
//make sure the name isn't taken
if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) {
if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) {
interpreter->errorOutput("Can't override an existing variable\n");
Toy_freeLiteral(alias);
return -1;
Expand Down
2 changes: 1 addition & 1 deletion repl/lib_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ int Toy_hookRunner(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lit
//store the library in an aliased dictionary
if (!TOY_IS_NULL(alias)) {
//make sure the name isn't taken
if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) {
if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) {
interpreter->errorOutput("Can't override an existing variable\n");
Toy_freeLiteral(alias);
return -1;
Expand Down
2 changes: 1 addition & 1 deletion repl/lib_standard.c
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,7 @@ int Toy_hookStandard(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_L
//store the library in an aliased dictionary
if (!TOY_IS_NULL(alias)) {
//make sure the name isn't taken
if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) {
if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) {
interpreter->errorOutput("Can't override an existing variable\n");
Toy_freeLiteral(alias);
return -1;
Expand Down
4 changes: 2 additions & 2 deletions source/toy_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The current minor version of Toy. This value is embedded into the bytecode, and
This value MUST fit into an unsigned char.
!*/

#define TOY_VERSION_MINOR 1
#define TOY_VERSION_MINOR 2

/*!
### TOY_VERSION_PATCH
Expand All @@ -64,7 +64,7 @@ The current patch version of Toy. This value is embedded into the bytecode.
This value MUST fit into an unsigned char.
!*/

#define TOY_VERSION_PATCH 7
#define TOY_VERSION_PATCH 0

/*!
### TOY_VERSION_BUILD
Expand Down
4 changes: 2 additions & 2 deletions source/toy_interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ static bool execVarAssign(Toy_Interpreter* interpreter) {
return false;
}

if (!Toy_isDelcaredScopeVariable(interpreter->scope, lhs)) {
if (!Toy_isDeclaredScopeVariable(interpreter->scope, lhs)) {
interpreter->errorOutput("Undeclared variable \"");
Toy_printLiteralCustom(lhs, interpreter->errorOutput);
interpreter->errorOutput("\"\n");
Expand Down Expand Up @@ -1467,7 +1467,7 @@ bool Toy_callFn(Toy_Interpreter* interpreter, const char* name, Toy_LiteralArray
Toy_Literal key = TOY_TO_IDENTIFIER_LITERAL(Toy_createRefStringLength(name, strlen(name)));
Toy_Literal val = TOY_TO_NULL_LITERAL;

if (!Toy_isDelcaredScopeVariable(interpreter->scope, key)) {
if (!Toy_isDeclaredScopeVariable(interpreter->scope, key)) {
interpreter->errorOutput("No function with that name\n");
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion source/toy_scope.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ bool Toy_declareScopeVariable(Toy_Scope* scope, Toy_Literal key, Toy_Literal typ
return true;
}

bool Toy_isDelcaredScopeVariable(Toy_Scope* scope, Toy_Literal key) {
bool Toy_isDeclaredScopeVariable(Toy_Scope* scope, Toy_Literal key) {
while (scope != NULL) {
if (Toy_existsLiteralDictionary(&scope->variables, key)) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions source/toy_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ This function returns true on success, otherwise it returns failure (such as if
TOY_API bool Toy_declareScopeVariable(Toy_Scope* scope, Toy_Literal key, Toy_Literal type);

/*!
### bool Toy_isDelcaredScopeVariable(Toy_Scope* scope, Toy_Literal key)
### bool Toy_isDeclaredScopeVariable(Toy_Scope* scope, Toy_Literal key)
This function checks to see if a given variable with the name `key` has been previously declared.
!*/
TOY_API bool Toy_isDelcaredScopeVariable(Toy_Scope* scope, Toy_Literal key);
TOY_API bool Toy_isDeclaredScopeVariable(Toy_Scope* scope, Toy_Literal key);

/*!
### bool Toy_setScopeVariable(Toy_Scope* scope, Toy_Literal key, Toy_Literal value, bool constCheck)
Expand Down

0 comments on commit ba98624

Please sign in to comment.