Esempio n. 1
0
        /// <summary>
        /// Fetches the value of a variable stored in the scope and returns
        /// a Boolean indicating success of the lookup.
        ///
        /// When the method's result is false, then it assigns null to value.
        ///
        /// If there is no engine associated with the scope (see ScriptRuntime.CreateScope),
        /// then the name lookup is a literal lookup of the name in the scope's dictionary.  Therefore,
        /// it is case-sensitive for example.
        ///
        /// If there is a default engine, then the name lookup uses that language's semantics.
        /// </summary>
        public bool TryGetVariable(ScriptScope scope, string name, out object value)
        {
            ContractUtils.RequiresNotNull(scope, "scope");
            ContractUtils.RequiresNotNull(name, "name");

            return(_language.TryLookupName(GetCodeContext(scope), SymbolTable.StringToId(name), out value));
        }