Пример #1
0
        internal VariableDef CreateTypedVariable(Node node, AnalysisUnit unit, string name, IAnalysisSet types, bool addRef = true)
        {
            VariableDef res;

            if (!TryGetVariable(name, out res))
            {
                // Normal CreateVariable would use AddVariable, which will put
                // the typed one in the wrong scope.
                res = base.AddVariable(name);
            }
            if (addRef)
            {
                res.AddReference(node, unit);
            }

            var instTypes = types.GetInstanceType();

            res.AddTypes(unit, instTypes);

            foreach (var scope in OuterScope.EnumerateTowardsGlobal)
            {
                scope.TryPropagateVariable(node, unit, name, instTypes, res, addRef);
                scope.AddLinkedVariable(name, res);

                if (!(scope is IsInstanceScope))
                {
                    break;
                }
            }
            return(res);
        }
Пример #2
0
 public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
 {
     return(_returnTypes.GetInstanceType());
 }