DerivcoIpswich / dsharp

A fork of the Script# project.
http://www.derivco.co.uk
Other
20 stars 13 forks source link

$TArgs is not propagated across static methods if these are in different classes #204

Closed isc30 closed 4 years ago

isc30 commented 4 years ago

When calling a generic method, $TArgs should be propagated always as a first argument, but it doesn't if the methods are static and defined in different static class.

Source Code:

public static class BugUtils1
{
    public static IEnumerable<T> TestGenerics<T>(IEnumerable<T> source)
    {
        return BugUtils2.TestGenerics<T>(source);
    }
}

public static class BugUtils2
{
    public static IEnumerable<T> TestGenerics<T>(IEnumerable<T> source)
    {
        return BugUtils1.TestGenerics<T>(source);
    }
}

Transpiled:

// BugUtils1

function BugUtils1() {
}
BugUtils1.testGenerics = function($TArgs, source) {
    return BugUtils2.testGenerics(source);
};

// BugUtils2

function BugUtils2() {
}
BugUtils2.testGenerics = function($TArgs, source) {
    return BugUtils1.testGenerics(source);
};

Expected Output:

BugUtils1.testGenerics = function($TArgs, source) {
    return BugUtils2.testGenerics({'T': $TArgs['T']}, source);
};

BugUtils2.testGenerics = function($TArgs, source) {
    return BugUtils1.testGenerics({'T': $TArgs['T']}, source);
};