Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methodmap function recursion call compilation error #230

Open
Kailo97 opened this issue Jul 25, 2018 · 1 comment
Open

Methodmap function recursion call compilation error #230

Kailo97 opened this issue Jul 25, 2018 · 1 comment

Comments

@Kailo97
Copy link
Contributor

Kailo97 commented Jul 25, 2018

int g_a = 0;

methodmap CTest
{
	public static void A()
	{
		g_a++;
		if (g_a == 5)
			PrintToServer("Done");
		else
			CTest.A(); // error 105: cannot find method or property CTest.A
	}
}

public void OnPluginStart()
{
	CTest.A();
}

This is probably good test case

methodmap MM { public static void sFunc(int a = 0) { if (a < 5) MM.sFunc(a + 1); } };
public void main() { MM.sFunc(); }

Test environment: Windows 10, SM 1.9.0.6245 & 1.10.0.6316

Update: the same for non-static

methodmap MM < Handle
{
	public void sFunc(int a = 0)
	{
		if (a < 5)
			this.sFunc(a + 1); // error 105: cannot find method or property MM.sFunc
	}
}

public void OnPluginStart()
{
	view_as<MM>(GetMyHandle()).sFunc();
}
@Kailo97 Kailo97 changed the title Static methodmap function recursion call compilation error Methodmap function recursion call compilation error Jul 25, 2018
@geominorai
Copy link

It is also not possible to call methods declared below the current one, unlike normal function declarations not inside a methodmap block:

methodmap Test {
  public void FuncA() {
  	this.FuncB(); // error 105: cannot find method or property Test.FuncB
  }

  public void FuncB() {

  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants