nikhilk / scriptsharp

Script# Project - a C# to JavaScript compiler, to power your HTML5 and Node.js web development.
http://scriptsharp.com
Other
658 stars 182 forks source link

Generation of script is interrupted when certain code pattern is found #434

Closed ggasteratos closed 9 years ago

ggasteratos commented 9 years ago

Generation of script is interrupted when certain code pattern is found

Hi, We have the following script# code

[ScriptIgnoreNamespace]
[ScriptImport]
[ScriptName("Object")]
public class SubmitDetails
{
    [ScriptField, ScriptName(PreserveCase = true)]
    public string ChainedActionName { get { return null; } set { } }
}

public class ActionBehavior
{
    public string ProcessName;
}

[ScriptName("Object")]
public class ConstructOpenFormArg
{
    public string ProcessName;
    public string ActionName;

    public ConstructOpenFormArg(string processName, string actionName)
    {
        ProcessName = processName;
        ActionName = actionName;
    }
}

public static class ActionManager
{
    private static void RedirectAfterSubmit(ActionBehavior initiateActionObject, SubmitDetails submitDetails)
    {
        ConstructOpenFormArg arg = new ConstructOpenFormArg(initiateActionObject.ProcessName, submitDetails.ChainedActionName);
    }
}

The script that gets generated is this:

define('Module1', ['ss'], function(ss) { var $global = this;

function ActionBehavior() { } var ActionBehavior$ = { };

function Object(processName, actionName) { this.processName = processName; this.actionName = actionName; } var Object$ = { };

function ActionManager() { } ActionManager._redirectAfterSubmit = function(initiateActionObject, submitDetails) { var arg = { return $exports; });

As you can see the script generation stops at var arg = {

Any idea what is causing it?

Thanks in advance, Greg.

ggasteratos commented 9 years ago

Actually I found a workaround. If I remove the attribute [ScriptName("Object")] from the class ConstructOpenFormArg it works fine.

Many thanks.