Skip to content

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

@JoasE

Description

@JoasE

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions