Exemplo n.º 1
0
        public override Value Execute(Args args, Environment environment, SourcePos pos)
        {
            var result = new ValueList();

            if (!args.HasArg("module"))
            {
                foreach (var symbol in environment.GetSymbols())
                {
                    result.AddItem(new ValueString(symbol));
                }
            }
            else
            {
                var moduleArg = args.Get("module");
                Dictionary <string, Value> module;
                if (moduleArg.IsString())
                {
                    module = environment.Get(moduleArg.AsString().GetValue(), pos).AsObject().value;
                }
                else
                {
                    module = args.Get("module").AsObject().value;
                }
                foreach (var symbol in module.Keys)
                {
                    result.AddItem(new ValueString(symbol));
                }
            }
            return(result);
        }