protected override string Execute(ScriptingContext context, Expression expression, DisplayFormat format) { TargetType type = expression.EvaluateType (context); string text = context.FormatType (type); context.Print (text); return text; }
protected override string Execute(ScriptingContext context, Expression expression, DisplayFormat format) { // try-catch block for whole method: if an exception occurs, we are able to // release the semaphore waiting for the command answer try { TargetType type = expression.EvaluateType (context); string fieldNames = ""; string fieldNamesStaticOnly = ""; if (type.Kind == TargetObjectKind.Class || type.Kind == TargetObjectKind.Struct) { TargetClassType stype = (TargetClassType) type; foreach (TargetFieldInfo field in stype.Fields) { fieldNames += field.Name; fieldNames += " "; if (field.IsStatic) { fieldNamesStaticOnly += field.Name; fieldNamesStaticOnly += " "; } } fieldNames = fieldNames.Trim(); fieldNamesStaticOnly = fieldNamesStaticOnly.Trim(); } string text = context.FormatType (type); context.Print (text); EmonicInterpreter.ptypeOutput = fieldNames; EmonicInterpreter.ptypeOutputStaticOnly = fieldNamesStaticOnly; EmonicInterpreter.ptypeSem.Release(); return text; } catch { EmonicInterpreter.ptypeOutput = "--"; EmonicInterpreter.ptypeOutputStaticOnly = "--"; EmonicInterpreter.ptypeSem.Release(); throw; } }