cherry picking ord-nas's bug fix from master

This commit is contained in:
OrdNas 2014-11-26 17:58:53 -08:00 committed by Justin Meza
parent e500678dae
commit d95f751de5
24 changed files with 35 additions and 6 deletions

View File

@ -784,14 +784,20 @@ ScopeObject *getScopeObjectLocalCaller(ScopeObject *src,
/* Check for value in current scope */
for (n = 0; n < current->numvals; n++) {
if (!strcmp(current->names[n], name)) {
/* HACK: functions can by used as scopes */
if (current->values[n]->type != VT_ARRAY
&& current->values[n]->type != VT_FUNC) {
error(IN_VARIABLE_NOT_AN_ARRAY, target->fname, target->line, name);
goto getScopeObjectLocalCallerAbort;
}
free(name);
return getArray(current->values[n]);
if (current->values[n]->type == VT_ARRAY)
{
return getArray(current->values[n]);
}
else
{
return dest;
}
}
}
} while ((current = current->parent));

View File

@ -1,2 +0,0 @@
INCLUDE(AddLolTest)
ADD_LOL_TEST(11-AlternateSyntax OUTPUT test.out)

View File

@ -0,0 +1,2 @@
INCLUDE(AddLolTest)
ADD_LOL_TEST(11-CallingObjectAlternateSyntax OUTPUT test.out)

View File

@ -0,0 +1,15 @@
HAI 1.3
I HAS A foo ITZ A BUKKIT
foo HAS A bar ITZ 123
HOW IZ foo fun1
I HAS A bar ITZ 4.567
VISIBLE bar
VISIBLE ME'Z bar
ME'Z bar R 890
VISIBLE ME'Z bar
IF U SAY SO
foo IZ fun1 MKAY
VISIBLE foo'Z bar
KTHXBYE

View File

@ -0,0 +1 @@
This test checks that the alternate syntax for calling a function in an array slot works.

View File

@ -0,0 +1,2 @@
INCLUDE(AddLolTest)
ADD_LOL_TEST(12-AlternateSyntax OUTPUT test.out)

View File

@ -0,0 +1,4 @@
4.56
123
890
890

View File

@ -8,5 +8,6 @@ add_subdirectory(7-CallingObjectReference)
add_subdirectory(8-CallingObjectAssignment)
add_subdirectory(9-CallingObjectDeclaration)
add_subdirectory(10-CallingObjectInitialization)
add_subdirectory(11-AlternateSyntax)
add_subdirectory(12-Inheritance)
add_subdirectory(13-Inheritance)
add_subdirectory(12-AlternateSyntax)
add_subdirectory(11-CallingObjectAlternateSyntax)