From 439554231982bd0cd3ebaa2560f1a1dd5ac74156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Sun, 3 Feb 2019 14:46:35 +0100 Subject: [PATCH] fix #1699 --- .../IB/Debugger/ExpressionEvaluation.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/VisualPascalABCNET/IB/Debugger/ExpressionEvaluation.cs b/VisualPascalABCNET/IB/Debugger/ExpressionEvaluation.cs index 869c7e03f..883081286 100644 --- a/VisualPascalABCNET/IB/Debugger/ExpressionEvaluation.cs +++ b/VisualPascalABCNET/IB/Debugger/ExpressionEvaluation.cs @@ -5612,7 +5612,25 @@ namespace VisualPascalABC if (pars.Length != 1) throw new WrongNumberArguments(name); break; + default: + Type t = AssemblyHelper.GetType(name); + if (t != null) + { + if (pars.Length != 1) + throw new WrongNumberArguments(name); + if (pars[0] is Value) + { + Value v = pars[0] as Value; + DebugType dt = DebugUtils.GetDebugType(t); + if (dt == v.Type || v.Type.IsSubclassOf(dt)) + return v; + else + throw new InvalidCastException(); + } + else + throw new InvalidCastException(); + } throw new UnknownName(name); } try @@ -5894,10 +5912,10 @@ namespace VisualPascalABC { throw new WrongTypeOfArgument(name); } - catch (System.InvalidCastException) + /*catch (System.InvalidCastException) { throw new WrongTypeOfArgument(name); - } + }*/ return null; } @@ -6664,6 +6682,11 @@ namespace VisualPascalABC args.Add(GetSimpleValue(rv)); } res.prim_val = EvalStandFuncWithParam(id.name, args.ToArray()); + if (res.prim_val is Value) + { + res.obj_val = res.prim_val as Value; + res.prim_val = null; + } } eval_stack.Push(res); }