예제 #1
0
 /// <summary>
 /// Whether or not the variable name provided is an external host language( C# ) type name.
 /// </summary>
 /// <param name="memory">The memory space of the runtime.</param>
 /// <param name="types">The collection of registered external types.</param>
 /// <param name="varName">The name associated with the member access.</param>
 /// <returns></returns>
 public static BoolMsgObj IsExternalTypeName(Memory memory, RegisteredTypes types, string varName)
 {
     Type type = null;
     var isStatic = false;
     
     // 1. Class name : "Person" as in "Person.Create" -> so definitely a static method call on custom object.
     if (types.Contains(varName))
     {
         type = types.Get(varName);
     }
     // 2. Case insensitive Class name: "person" as in "Person.Create" but "person" variable doesn't exist.
     else if (!memory.Contains(varName))
     {
         // Only do this check for "user" -> "User" class / static method.
         var first = Char.ToUpper(varName[0]);
         var name = first + varName.Substring(1);
         if (types.Contains(name))
         {
             type = types.Get(name);
         }
     }
     if (type != null) isStatic = true;
     return new BoolMsgObj(type, isStatic, string.Empty);
 }