本文整理汇总了C#中D_Parser.Resolver.AbstractType.ToCode方法的典型用法代码示例。如果您正苦于以下问题:C# AbstractType.ToCode方法的具体用法?C# AbstractType.ToCode怎么用?C# AbstractType.ToCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类D_Parser.Resolver.AbstractType
的用法示例。
在下文中一共展示了AbstractType.ToCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenTooltipSignature
public string GenTooltipSignature(AbstractType t, bool templateParamCompletion = false, int currentMethodParam = -1)
{
var ds = t as DSymbol;
if (ds != null)
{
if (currentMethodParam >= 0 && !templateParamCompletion && ds.Definition is DVariable && ds.Base != null)
return GenTooltipSignature(ds.Base, false, currentMethodParam);
var aliasedSymbol = ds.Tag<TypeDeclarationResolver.AliasTag>(TypeDeclarationResolver.AliasTag.Id);
return GenTooltipSignature(aliasedSymbol == null || currentMethodParam >= 0 ? ds.Definition : aliasedSymbol.aliasDefinition, templateParamCompletion, currentMethodParam, DTypeToTypeDeclVisitor.GenerateTypeDecl(ds.Base), new DeducedTypeDictionary(ds));
}
if (t is PackageSymbol)
{
var pack = (t as PackageSymbol).Package;
return "<i>(Package)</i> " + pack.ToString();
}
if (t is DelegateType)
{
var sb = new StringBuilder();
GenDelegateSignature(t as DelegateType, sb, templateParamCompletion, currentMethodParam);
return sb.ToString();
}
return DCodeToMarkup(t != null ? t.ToCode(true) : "null");
}
示例2: GenTooltipSignature
public string GenTooltipSignature(AbstractType t, bool templateParamCompletion = false, int currentMethodParam = -1)
{
var ds = t as DSymbol;
if (ds != null)
{
var aliasedSymbol = ds.Tag as D_Parser.Resolver.TypeResolution.TypeDeclarationResolver.AliasTag;
return GenTooltipSignature(aliasedSymbol == null ? ds.Definition : aliasedSymbol.aliasDefinition, templateParamCompletion, currentMethodParam, DTypeToTypeDeclVisitor.GenerateTypeDecl(ds.Base), ds.DeducedTypes != null ? new DeducedTypeDictionary(ds) : null);
}
if (t is PackageSymbol) {
var pack = (t as PackageSymbol).Package;
return "<i>(Package)</i> "+pack.ToString();
}
return DCodeToMarkup (t != null ? t.ToCode () : "null");
}
示例3: EvaluateInterfaceInstance
ObjectValue EvaluateInterfaceInstance(string exp, ObjectValueFlags flags, ObjectPath path, ref AbstractType actualClassType)
{
exp ="**(int*)(" + MemoryExamination.BuildAddressExpression(exp) + ")+"+Memory.CalcOffset(1);
return ObjectValue.CreateError (ValueSource, path, actualClassType.ToCode (), "", flags);
//return EvaluateClassInstance(exp, flags, path, ref actualClassType);
/*
IntPtr lOffset;
byte[] bytes = Memory.ReadInstanceBytes(exp, out ctype, out lOffset, resolutionCtx);*/
}
示例4: EvaluateClassInstance
ObjectValue EvaluateClassInstance (string exp, ObjectValueFlags flags, ObjectPath path, ref AbstractType actualClassType)
{
// Check if null
IntPtr ptr;
if (!Memory.Read (exp[0] == MemoryExamination.EnforceReadRawExpression ? exp : (MemoryExamination.EnforceReadRawExpression + exp), out ptr) ||
ptr.ToInt64 () < 1)
return ObjectValue.CreateNullObject (ValueSource, path, actualClassType == null ? "<Unkown type>" : actualClassType.ToCode (), flags);
// Invoke and evaluate object's toString()
string representativeDisplayValue = Backtrace.DSession.ObjectToStringExam.InvokeToString (exp);
// Read the current object instance type
// which might be different from the declared type due to inheritance or interfacing
var typeName = Memory.ReadDynamicObjectTypeString (exp);
if (string.IsNullOrEmpty (representativeDisplayValue))
representativeDisplayValue = typeName;
// Interpret & resolve the parsed string so it'll become accessible for abstract examination
ITypeDeclaration bt = null;
if (!string.IsNullOrEmpty (typeName))
{
DToken optToken;
bt = DParser.ParseBasicType (typeName, out optToken);
StripTemplateTypes (ref bt);
actualClassType = TypeDeclarationResolver.ResolveSingle (bt, resolutionCtx) ?? actualClassType;
}
if (actualClassType == null) {
Backtrace.DSession.LogWriter (false,"Couldn't resolve \""+exp+"\":\nUnresolved Type: "+typeName+"\n");
Backtrace.DSession.LogWriter (false,"Ctxt: "+resolutionCtx.ScopedBlock.ToString()+"\n");
}
return ObjectValue.CreateObject (ValueSource, path,
bt != null ? bt.ToString(true) :
(actualClassType is DSymbol ?
(actualClassType as DSymbol).Definition.ToString(false) :
"<Unknown object type>"),
representativeDisplayValue, flags, null);
}
示例5: EvaluateVariable
ObjectValue EvaluateVariable (string exp, ref AbstractType t, ObjectValueFlags flags, ObjectPath path)
{
if (t is PrimitiveType)
return EvaluatePrimitive (exp, t as PrimitiveType, flags, path);
else if (t is PointerType)
return EvaluatePointer(exp, t as PointerType, flags, path);
else if (t is ArrayType)
return EvaluateArray (exp, t as ArrayType, flags, path);
else if (t is AssocArrayType)
return EvaluateAssociativeArray (exp, t as AssocArrayType, flags, path);
else if (t is InterfaceType)
return EvaluateInterfaceInstance(exp, flags, path, ref t);
else if (t is ClassType)
return EvaluateClassInstance (exp, flags, path, ref t);
else if(t is StructType)
return ObjectValue.CreateObject(ValueSource, path, t.ToCode(), t.ToCode(), flags, null);
return ObjectValue.CreateUnknown(ValueSource, path, t == null ? "<Unknown type>" : t.ToCode());
}