示例#1
0
        public static ISymbolValue EvaluateValue(VariableValue v, AbstractSymbolValueProvider vp)
        {
            if(v.RepresentedType is TemplateParameterSymbol)
            {
                var tps = v.RepresentedType as TemplateParameterSymbol;
                if(tps.ParameterValue != null)
                    return tps.ParameterValue;
            }

            var bt = v.Member;
            var ctxt = vp.ResolutionContext;
            bool pop=false;

            if(bt != null)
            {
                //TODO: This is not tested entirely - but it makes test passing successfully!
                pop = true;
                ctxt.PushNewScope (bt.Definition.Parent as Dom.IBlockNode);
                ctxt.CurrentContext.IntroduceTemplateParameterTypes(bt);
            }

            var val = vp[v.Variable];

            if(bt != null)
            {
                if (pop)
                    ctxt.Pop ();
                vp.ResolutionContext.CurrentContext.RemoveParamTypesFromPreferredLocals(bt);
            }

            return val ?? v;
        }