示例#1
0
        /// <summary>
        /// This method removes the variable name and returns whether
        /// the variable was bound in the scope when you called this method.
        ///
        /// 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.
        ///
        /// Some languages may refuse to remove some variables.  If the scope has a default language that has bound
        /// variables that cannot be removed, the language engine throws an exception.
        /// </summary>
        public bool RemoveVariable(ScriptScope scope, string name)
        {
            ContractUtils.RequiresNotNull(scope, "scope");
            ContractUtils.RequiresNotNull(name, "name");

            return(_language.RemoveName(GetCodeContext(scope), SymbolTable.StringToId(name)));
        }