Open sushihangover opened 8 years ago
Workaround:
var array:Array = new Array("1", "2", "3");
var i:int = 0;
//var line:String = new String( array[i] );
var line:String = array[i] as String;
ps-lang.cs
if (sn != null && IsPlayScriptScalarClass (sn.Name) && inv.Arguments != null && inv.Arguments.Count == 1) {
Argument arg = inv.Arguments [0].Clone (new CloneContext ());
arg.Resolve (ec);
if (arg.Expr.Type != null) {
if (BuiltinTypeSpec.IsPrimitiveType (arg.Expr.Type) || arg.Expr.Type.BuiltinType == BuiltinTypeSpec.Type.String)
return arg.Expr;
}
// TODO: ActionScript does actually allow this, but its runtime
// rules are hard to implement at compile time, and this should
// be a rare use case, so I am leaving it as a compiler error for
// now.
ec.Report.Error (7112, loc, "The type `{0}' does not contain a constructor that takes non-scalar arguments", sn.Name);
return null;
}
Error CS7112: The type `String' does not contain a constructor that takes non-scalar arguments (CS7112)
Example valid AS code:
Where found: AGALMiniAssembler.as