/// <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));
        }
Exemple #2
0
 /// <summary>
 /// Is the type registered. Does not trigger building of the container.
 /// </summary>
 /// <typeparam name="T">Type to verify</typeparam>
 /// <returns>True if the type is registered, otherwise false</returns>
 public override bool IsRegistered <T>()
 {
     if (_container.IsValueCreated)
     {
         return(_container.Value.IsRegistered <T>());
     }
     return(RegisteredTypes.Contains(typeof(T)));
 }
Exemple #3
0
 public override bool IsRegistered <T>()
 {
     if (_container != null)
     {
         return(_container.IsRegistered <T>());
     }
     return(RegisteredTypes.Contains(typeof(T)));
 }