private TypeParser.Type[] ParseGenericArguments(int arity) { TypeParser.Type[] typeArray = null; if (this.position == this.length || this.fullname[this.position] != '[') { return(typeArray); } this.TryParse('['); for (int i = 0; i < arity; i++) { bool flag = this.TryParse('['); TypeParser.Add <TypeParser.Type>(ref typeArray, this.ParseType(flag)); if (flag) { this.TryParse(']'); } this.TryParse(','); this.TryParseWhiteSpace(); } this.TryParse(']'); return(typeArray); }
private static bool TryGetDefinition(ModuleDefinition module, TypeParser.Type type_info, out TypeReference type) { type = null; if (!TypeParser.TryCurrentModule(module, type_info)) { return(false); } TypeDefinition nestedType = module.GetType(type_info.type_fullname); if (nestedType == null) { return(false); } string[] nestedNames = type_info.nested_names; if (!nestedNames.IsNullOrEmpty <string>()) { for (int i = 0; i < (int)nestedNames.Length; i++) { nestedType = nestedType.GetNestedType(nestedNames[i]); } } type = nestedType; return(true); }
public TypeReference GetType(string fullName, bool runtimeName) { return(runtimeName ? TypeParser.ParseType(this, fullName) : GetType(fullName)); }
public TypeReference GetType(string fullName, bool runtimeName) { return(runtimeName ? TypeParser.ParseType(this, fullName, typeDefinitionOnly: true) : GetType(fullName)); }
private void WriteTypeReference(TypeReference type) { this.WriteUTF8String(TypeParser.ToParseable(type)); }
public TypeReference GetType(string fullName, bool runtimeName) => (runtimeName ? TypeParser.ParseType(this, fullName) : this.GetType(fullName));
public TypeDefinition GetType(string fullname) { TypeParser.SplitFullName(fullname, out string @namespace, out string name); return(GetType(@namespace, name)); }
public TypeReference ReadTypeReference() { return(TypeParser.ParseType(this.reader.module, this.ReadUTF8String())); }
public TypeReference ReadTypeReference() { return(TypeParser.ParseType(reader.module, ReadUTF8String(), false)); }
private static void AppendTypeSpecification(TypeSpecification type, StringBuilder name) { ArrayType arrayType; int i; StringBuilder stringBuilder; StringBuilder stringBuilder1; StringBuilder stringBuilder2; StringBuilder stringBuilder3; if (type.ElementType.IsTypeSpecification()) { TypeParser.AppendTypeSpecification((TypeSpecification)type.ElementType, name); } ElementType elementType = type.etype; switch (elementType) { case ElementType.Ptr: { name.Append('*'); return; } case ElementType.ByRef: { name.Append('&'); return; } case ElementType.ValueType: case ElementType.Class: case ElementType.Var: { return; } case ElementType.Array: { arrayType = (ArrayType)type; if (arrayType.IsVector) { stringBuilder = name.Append("[]"); return; } stringBuilder1 = name.Append('['); for (i = 1; i < arrayType.Rank; i++) { stringBuilder2 = name.Append(','); } stringBuilder3 = name.Append(']'); return; } case ElementType.GenericInst: { Collection <TypeReference> genericArguments = ((GenericInstanceType)type).GenericArguments; name.Append('['); for (int j = 0; j < genericArguments.Count; j++) { if (j > 0) { name.Append(','); } TypeReference item = genericArguments[j]; bool scope = item.Scope != item.Module; if (scope) { name.Append('['); } TypeParser.AppendType(item, name, true, false); if (scope) { name.Append(']'); } } name.Append(']'); return; } default: { if (elementType == ElementType.SzArray) { arrayType = (ArrayType)type; if (arrayType.IsVector) { stringBuilder = name.Append("[]"); return; } stringBuilder1 = name.Append('['); for (i = 1; i < arrayType.Rank; i++) { stringBuilder2 = name.Append(','); } stringBuilder3 = name.Append(']'); return; } return; } } }