Пример #1
0
            public override QsExpressionKind <TypedExpression, Identifier, ResolvedType> onIdentifier(Identifier sym, QsNullable <ImmutableArray <ResolvedType> > tArgs)
            {
                if (sym is Identifier.GlobalCallable global)
                {
                    ImmutableConcretion applicableParams = CurrentParamTypes
                                                           .Where(kvp => kvp.Key.Item1.Equals(global.Item))
                                                           .ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value);

                    // Create a new identifier
                    sym   = GetConcreteIdentifier(global, applicableParams);
                    tArgs = QsNullable <ImmutableArray <ResolvedType> > .Null;

                    // Remove Type Params used from the CurrentParamTypes
                    foreach (var key in applicableParams.Keys)
                    {
                        CurrentParamTypes.Remove(key);
                    }
                }
                else if (sym is Identifier.LocalVariable && tArgs.IsValue && tArgs.Item.Any())
                {
                    throw new ArgumentException($"Local variables cannot have type arguments.");
                }

                return(base.onIdentifier(sym, tArgs));
            }