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

Bug: Static member accessed with redundant class qualifier converts incorrectly #44

Closed
JoasE opened this issue Jun 3, 2018 · 2 comments

Comments

@JoasE
Copy link
Contributor

JoasE commented Jun 3, 2018

When the redundant class qualifier is used to access a static property, the converter thinks it has to find the property somewhere else.

Example

using System;

namespace TestApp
{
	class Program
	{
		public static string Test { get; set; }

		static void Main(string[] args)
		{
			Console.WriteLine(Program.Test);
			Console.WriteLine(Test);
		}
	}
}

Converts to:

-- Generated by CSharp.lua Compiler 1.1.0
local System = System
local TestApp
System.usingDeclare(function (global) 
  TestApp = global.TestApp
end)
System.namespace("TestApp", function (namespace) 
  namespace.class("Program", function (namespace) 
	local Main
	Main = function (args) 
	  System.Console.WriteLine(Test) -- note the converter tries to access something that doesn't exists in this context
	  System.Console.WriteLine(TestApp.Program.Test)
	end
	return {
	  Main = Main
	}
  end)
end)

Command I executed: >dotnet "CSharp.lua.Launcher.dll" -s "C:\Users\Joas\source\repos\TestApp\TestApp" -d "C:\Users\Joas\Desktop\Test"

Version: 1.1.3

I've tried debugging the issue, but I find it a lot of work since there's no technical documentation in the solution.

SIDE NOTE: Please consider at least adding ///<summary>'s for classes properties and methods.

@InDieTasten
Copy link

InDieTasten commented Jun 3, 2018

I've worked with the code a little bit. I think there is technical documentation in chinese as a document somewhere in the source tree.

This to me looks like a generation error, as I'm sure the C# AST tree is completely fine. So this issue is either when generating the Lua AST, or when generating Lua from the Lua AST

@yanghuan
Copy link
Owner

yanghuan commented Jun 3, 2018

thans port the bug. i will debug and fix it a later

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

3 participants