Exemple #1
0
        private void ScopeBeforeSetItem(IScriptScope sender, ScopeArgs args)
        {
            //TODO: Performance improvement. Should be evaluated once per function call
            List <string> globalNames = GetGlobalNames(_activeContext);

            if (globalNames.Contains(args.Name))
            {
                ScriptQualifiedName.SetToParentScope(sender.Parent, args.Name, args.Value);
                args.Cancel = true;
            }

            //if (!sender.HasVariable(args.Name))
            //{
            //  args.Cancel = SetToParentScope(sender.Parent, args.Name, args.Value);
            //}
        }
Exemple #2
0
        private void ScopeBeforeSetItem(IScriptScope sender, ScopeArgs args)
        {
            if (_globalNames.Contains(args.Name))
            {
                switch (args.Operation)
                {
                case ScopeOperation.Set:
                    ScriptQualifiedName.SetToParentScope(sender.Parent, args.Name, args.Value);
                    args.Cancel = true;
                    break;

                case ScopeOperation.Create:
                    throw new ScriptExecutionException(string.Format(Strings.LocalIdConflictWithGlobalList, args.Name));

                default:
                    break;
                }
            }
        }