예제 #1
0
        public static bool TryGetScript(string typeName, string scriptName, out TsDelegate del)
        {
            if (typeName == null)
            {
                del = null;
                return(false);
            }
            var origin = typeName;

            do
            {
                if (InstanceScripts.TryGetValue(typeName, scriptName, out del))
                {
                    //If the script is inherited, cache it in the child's script lookup.
                    if (typeName != origin)
                    {
                        InstanceScripts.Add(origin, scriptName, del);
                    }
                    return(true);
                }
            }while (Inherits.TryGetValue(typeName, out typeName));

            del = null;
            return(false);
        }
예제 #2
0
 /// <summary>
 /// Creates a TaffyScript object from a <see cref="TsDelegate"/>.
 /// </summary>
 /// <param name="script">The value of the object.</param>
 public TsObject(TsDelegate script)
 {
     Type  = VariableType.Delegate;
     Value = new TsImmutableValue <TsDelegate>(script);
 }