//------------------------------------------------------------ // ReflectionUtil.CreateTypeSearchName // /// <summary> /// Create a type name with the names of namespaces and arity. /// </summary> /// <param name="nsSym"></param> /// <param name="name"></param> /// <param name="arity"></param> /// <returns></returns> //------------------------------------------------------------ internal static string CreateTypeSearchName(NSSYM nsSym, string name, int arity) { DebugUtil.Assert(!String.IsNullOrEmpty(name)); StringBuilder sb = new StringBuilder(); Stack <string> nameStack = new Stack <string>(); nameStack.Push(null); while (nsSym != null) { nameStack.Push(nsSym.Name); nsSym = nsSym.ParentNsSym; } string temp = null; while ((temp = nameStack.Pop()) != null) { sb.Append(temp); if (sb.Length > 0) { sb.Append('.'); } } sb.Append(name); if (arity > 0 && name.IndexOf('`') < 0) { sb.AppendFormat("`{0}", arity); } return(sb.ToString()); }
//------------------------------------------------------------ // FUNCBREC.SetFncBrecExtFields // /// <summary></summary> /// <returns></returns> //------------------------------------------------------------ private bool SetFncBrecExtFields() { if (systemNsSym == null) { systemNsSym = Compiler.LookupInBagAid( "System", Compiler.MainSymbolManager.RootNamespaceSym, 0, 0, SYMBMASK.NSSYM) as NSSYM; } if (systemNsSym == null) { Compiler.Error(CSCERRID.ERR_SingleTypeNameNotFound, new ErrArg("System")); return(false); } if (reflectionNsSym == null) { reflectionNsSym = Compiler.LookupInBagAid( "Reflection", systemNsSym, 0, 0, SYMBMASK.NSSYM) as NSSYM; } if (reflectionNsSym == null) { Compiler.Error(CSCERRID.ERR_SingleTypeNameNotFound, new ErrArg("Reflection")); return(false); } if (systemTypeAggTypeSym == null) { systemTypeAggSym = Compiler.LookupInBagAid( "Type", systemNsSym, 0, 0, SYMBMASK.AGGSYM) as AGGSYM; systemTypeAggTypeSym = systemTypeAggSym.GetThisType(); } if (systemTypeAggTypeSym == null) { Compiler.Error(CSCERRID.ERR_SingleTypeNameNotFound, new ErrArg("Type")); return(false); } if (systemTypeArraySym == null) { systemTypeArraySym = Compiler.MainSymbolManager.GetArray( systemTypeAggTypeSym, 1, systemTypeAggTypeSym.Type.MakeArrayType()); } if (systemTypeArraySym == null) { Compiler.Error(CSCERRID.ERR_SingleTypeNameNotFound, new ErrArg("Type[]")); return(false); } return(true); }