예제 #1
0
 internal string GetTypeMapName(ISymbol symbol, string shortName)
 {
     if (MayHaveCodeMeta(symbol))
     {
         TypeMetaInfo info = typeMetas_.GetOrDefault(shortName);
         return(info?.Model.Name);
     }
     return(null);
 }
예제 #2
0
        private TypeMetaInfo GetTypeMetaInfo(ISymbol memberSymbol)
        {
            string       typeName = GetTypeShortString(memberSymbol.ContainingType);
            TypeMetaInfo info     = typeMetas_.GetOrDefault(typeName);

            if (info != null && info.Model.Baned)
            {
                throw new CompilationErrorException($"{memberSymbol.ContainingType} is baned");
            }
            return(info);
        }
예제 #3
0
 internal string GetTypeMapName(ISymbol symbol, string shortName)
 {
     if (MayHaveCodeMeta(symbol))
     {
         TypeMetaInfo info = typeMetas_.GetOrDefault(shortName);
         if (info != null && info.Model.Baned)
         {
             throw new CompilationErrorException($"{symbol} is baned");
         }
         return(info?.Model.Name);
     }
     return(null);
 }
예제 #4
0
        private void LoadType(string namespaceName, XmlMetaModel.ClassModel[] classes)
        {
            foreach (var classModel in classes)
            {
                string className = classModel.name;
                if (string.IsNullOrEmpty(className))
                {
                    throw new ArgumentException($"namespace [{namespaceName}] has a class's name is empty");
                }

                string classesfullName = namespaceName + '.' + className;
                classesfullName = classesfullName.Replace('^', '_');
                if (typeMetas_.ContainsKey(classesfullName))
                {
                    throw new ArgumentException($"type [{classesfullName}] is already has");
                }
                TypeMetaInfo info = new TypeMetaInfo(classModel);
                typeMetas_.Add(classesfullName, info);
            }
        }
예제 #5
0
        internal LuaIdentifierNameSyntax GetTypeShortName(ISymbol symbol, LuaSyntaxNodeTransfor transfor = null)
        {
            string name = GetTypeShortString(symbol);

            if (MayHaveCodeMeta(symbol))
            {
                TypeMetaInfo info = typeMetas_.GetOrDefault(name);
                if (info != null)
                {
                    string newName = info.Model.Name;
                    if (newName != null)
                    {
                        name = newName;
                    }
                }
            }
            if (transfor != null)
            {
                transfor.ImportTypeName(ref name, symbol);
            }
            return(new LuaIdentifierNameSyntax(name));
        }