Sfoglia il codice sorgente

Fix a bug introduced by checking function name already defined, the code was checking the first identifier but when declaring class methods outside class definition the first identifier is allways already defined (the class name).

mingodad 13 anni fa
parent
commit
50198dc2fd
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      SquiLu/squirrel/sqcompiler.cpp

+ 4 - 3
SquiLu/squirrel/sqcompiler.cpp

@@ -1493,14 +1493,15 @@ if(color == "yellow"){
 	{
 		SQObject id;
 		Lex(); id = Expect(TK_IDENTIFIER);
-		CheckGlobalName(id, true);
 		_fs->PushTarget(0);
 		_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(id));
-		if(_token == TK_DOUBLE_COLON) Emit2ArgsOP(_OP_GET);
+		if(_token == TK_DOUBLE_COLON) Emit2ArgsOP(_OP_GET);
+		else CheckGlobalName(id, true);
 
 		while(_token == TK_DOUBLE_COLON) {
 			Lex();
-			id = Expect(TK_IDENTIFIER);
+			id = Expect(TK_IDENTIFIER);
+			//todo check if class function already exists
 			_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(id));
 			if(_token == TK_DOUBLE_COLON) Emit2ArgsOP(_OP_GET);
 		}