mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
Add --experimental-transforms for undercooked implementations and add boxing of primitive types (see noise added to ScormEngine for aesthetic problems)
This commit is contained in:
parent
158e22b44f
commit
83fcfd0882
@ -128,6 +128,7 @@ namespace Twiglet.CS2J.Translator
|
|||||||
.Add ("translator-keep-parens=", v => cfg.TranslatorKeepParens = Boolean.Parse(v))
|
.Add ("translator-keep-parens=", v => cfg.TranslatorKeepParens = Boolean.Parse(v))
|
||||||
.Add ("translator-timestamp-files=", v => cfg.TranslatorAddTimeStamp = Boolean.Parse(v))
|
.Add ("translator-timestamp-files=", v => cfg.TranslatorAddTimeStamp = Boolean.Parse(v))
|
||||||
.Add ("translator-exception-is-throwable=", v => cfg.TranslatorExceptionIsThrowable = Boolean.Parse(v))
|
.Add ("translator-exception-is-throwable=", v => cfg.TranslatorExceptionIsThrowable = Boolean.Parse(v))
|
||||||
|
.Add ("experimental-transforms=", v => cfg.ExperimentalTransforms = Boolean.Parse(v))
|
||||||
;
|
;
|
||||||
|
|
||||||
//TODO: fix enum dump
|
//TODO: fix enum dump
|
||||||
|
@ -56,6 +56,11 @@ namespace Twiglet.CS2J.Translator
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ExperimentalTransforms
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
public CS2JSettings ()
|
public CS2JSettings ()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -88,6 +93,8 @@ namespace Twiglet.CS2J.Translator
|
|||||||
TranslatorKeepParens = true;
|
TranslatorKeepParens = true;
|
||||||
TranslatorAddTimeStamp = true;
|
TranslatorAddTimeStamp = true;
|
||||||
TranslatorExceptionIsThrowable = false;
|
TranslatorExceptionIsThrowable = false;
|
||||||
|
|
||||||
|
ExperimentalTransforms = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ scope {
|
|||||||
|
|
||||||
// We are calling a method on an expression. If it has a primitive type then cast it to
|
// We are calling a method on an expression. If it has a primitive type then cast it to
|
||||||
// the appropriate Object type.
|
// the appropriate Object type.
|
||||||
CommonTree e2InBox = expType.IsUnboxedType ? castToBoxedType(expType, $e2.tree, $d0.token) : $e2.tree;
|
CommonTree e2InBox = expType.IsUnboxedType && Cfg.ExperimentalTransforms ? castToBoxedType(expType, $e2.tree, $d0.token) : $e2.tree;
|
||||||
|
|
||||||
MethodRepTemplate methodRep = methodResult.Result as MethodRepTemplate;
|
MethodRepTemplate methodRep = methodResult.Result as MethodRepTemplate;
|
||||||
Dictionary<string,CommonTree> myMap = new Dictionary<string,CommonTree>();
|
Dictionary<string,CommonTree> myMap = new Dictionary<string,CommonTree>();
|
||||||
@ -679,7 +679,7 @@ scope {
|
|||||||
|
|
||||||
// We are calling a method on an expression. If it has a primitive type then cast it to
|
// We are calling a method on an expression. If it has a primitive type then cast it to
|
||||||
// the appropriate Object type.
|
// the appropriate Object type.
|
||||||
CommonTree e1InBox = $e1.dotNetType.IsUnboxedType ? castToBoxedType($e1.dotNetType, $e1.tree, $d1.token) : $e1.tree;
|
CommonTree e1InBox = $e1.dotNetType.IsUnboxedType && Cfg.ExperimentalTransforms ? castToBoxedType($e1.dotNetType, $e1.tree, $d1.token) : $e1.tree;
|
||||||
|
|
||||||
Dictionary<string,CommonTree> myMap = new Dictionary<string,CommonTree>();
|
Dictionary<string,CommonTree> myMap = new Dictionary<string,CommonTree>();
|
||||||
myMap["this"] = wrapExpression(e1InBox, $i1.tree.Token);
|
myMap["this"] = wrapExpression(e1InBox, $i1.tree.Token);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user