示例#1
0
        public override object ConstValue(IConstEvalCtx ctx = null)
        {
            if (Expression is AstSymbolRef symb)
            {
                var def = symb.Thedef;
                if (def == null || ctx == null || Args.Count != 1)
                {
                    return(null);
                }
                if (def.Undeclared && def.Global && def.Name == "require")
                {
                    var param = Args[0].ConstValue(ctx?.StripPathResolver());
                    if (!(param is string))
                    {
                        return(null);
                    }
                    return(ctx.ResolveRequire((string)param));
                }
            }

            return(null);
        }
示例#2
0
 public JsModule ResolveRequire(string name)
 {
     return(_ctx.ResolveRequire(name));
 }