Forráskód Böngészése

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 éve
szülő
commit
50198dc2fd
1 módosított fájl, 4 hozzáadás és 3 törlés
  1. 4 3
      SquiLu/squirrel/sqcompiler.cpp

+ 4 - 3
SquiLu/squirrel/sqcompiler.cpp

@@ -1493,14 +1493,15 @@ if(color == "yellow"){
 	{
 	{
 		SQObject id;
 		SQObject id;
 		Lex(); id = Expect(TK_IDENTIFIER);
 		Lex(); id = Expect(TK_IDENTIFIER);
-		CheckGlobalName(id, true);
 		_fs->PushTarget(0);
 		_fs->PushTarget(0);
 		_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(id));
 		_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) {
 		while(_token == TK_DOUBLE_COLON) {
 			Lex();
 			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));
 			_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);
 		}
 		}