Quellcode durchsuchen

Corrected a bug introduced by refactoring the compiler function "Expect", using a token paramter instead of "_token" in the new "GetTokenObject".

mingodad vor 13 Jahren
Ursprung
Commit
343ca7e2f2
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 4 4
      squirrel/sqcompiler.cpp

+ 4 - 4
squirrel/sqcompiler.cpp

@@ -105,10 +105,10 @@ public:
 		va_end(vl);
 		va_end(vl);
 	}
 	}
 	void Lex(){	_token = _lex.Lex();}
 	void Lex(){	_token = _lex.Lex();}
-	SQObjectPtr GetTokenObject()
+	SQObjectPtr GetTokenObject(SQInteger tok)
 	{
 	{
 		SQObjectPtr ret;
 		SQObjectPtr ret;
-		switch(_token)
+		switch(tok)
 		{
 		{
 		case TK_IDENTIFIER:
 		case TK_IDENTIFIER:
 			ret = _fs->CreateString(_lex._svalue);
 			ret = _fs->CreateString(_lex._svalue);
@@ -160,7 +160,7 @@ public:
 	SQObject Expect(SQInteger tok)
 	SQObject Expect(SQInteger tok)
 	{
 	{
         ErrorIfNotToken(tok);
         ErrorIfNotToken(tok);
-		return GetTokenObject();
+		return GetTokenObject(tok);
 	}
 	}
 	bool IsEndOfStatement() { return ((_lex._prevtoken == _SC('\n')) || (_token == SQUIRREL_EOB) || (_token == _SC('}')) || (_token == _SC(';'))); }
 	bool IsEndOfStatement() { return ((_lex._prevtoken == _SC('\n')) || (_token == SQUIRREL_EOB) || (_token == _SC('}')) || (_token == _SC(';'))); }
 	void OptionalSemicolon()
 	void OptionalSemicolon()
@@ -967,7 +967,7 @@ public:
 				break;
 				break;
 			case TK_STRING_LITERAL: //JSON
 			case TK_STRING_LITERAL: //JSON
 			case TK_IDENTIFIER: {//JSON
 			case TK_IDENTIFIER: {//JSON
-                SQObjectPtr obj = GetTokenObject();
+                SQObjectPtr obj = GetTokenObject(_token);
                 SQInteger next_token = _SC('=');
                 SQInteger next_token = _SC('=');
                 if(separator == ',' && _token == _SC(':')){ //only works for tables
                 if(separator == ',' && _token == _SC(':')){ //only works for tables
                     next_token = _token;
                     next_token = _token;