0.3.0; update wren to latest in 0.3.0

This commit is contained in:
underscorediscovery 2020-06-05 11:29:39 -07:00
parent b92b275ac6
commit 6e23a9f1d7
3 changed files with 9 additions and 16 deletions

View File

@ -2201,13 +2201,6 @@ static void staticField(Compiler* compiler, bool canAssign)
bareName(compiler, canAssign, variable);
}
// Returns `true` if [name] is a local variable name (starts with a lowercase
// letter).
static bool isLocalName(const char* name)
{
return name[0] >= 'a' && name[0] <= 'z';
}
// Compiles a variable name or method call with an implicit receiver.
static void name(Compiler* compiler, bool canAssign)
{
@ -2231,7 +2224,7 @@ static void name(Compiler* compiler, bool canAssign)
// If we're inside a method and the name is lowercase, treat it as a method
// on this.
if (isLocalName(token->start) && getEnclosingClass(compiler) != NULL)
if (wrenIsLocalName(token->start) && getEnclosingClass(compiler) != NULL)
{
loadThis(compiler);
namedCall(compiler, canAssign, CODE_CALL_0);

View File

@ -1498,13 +1498,6 @@ int wrenDeclareVariable(WrenVM* vm, ObjModule* module, const char* name,
return wrenSymbolTableAdd(vm, &module->variableNames, name, length);
}
// Returns `true` if [name] is a local variable name (starts with a lowercase
// letter).
static bool isLocalName(const char* name)
{
return name[0] >= 'a' && name[0] <= 'z';
}
int wrenDefineVariable(WrenVM* vm, ObjModule* module, const char* name,
size_t length, Value value, int* line)
{
@ -1530,7 +1523,7 @@ int wrenDefineVariable(WrenVM* vm, ObjModule* module, const char* name,
// If this was a localname we want to error if it was
// referenced before this definition.
if (isLocalName(name)) symbol = -3;
if (wrenIsLocalName(name)) symbol = -3;
}
else
{

View File

@ -236,4 +236,11 @@ static inline ObjClass* wrenGetClassInline(WrenVM* vm, Value value)
return NULL;
}
// Returns `true` if [name] is a local variable name (starts with a lowercase
// letter).
static inline bool wrenIsLocalName(const char* name)
{
return name[0] >= 'a' && name[0] <= 'z';
}
#endif