Ejemplo n.º 1
0
        private EvaluationResult EvaluateResolvedEntry(Context context, QualifierId qualifier, FilePosition filePosition, ResolvedEntry resolvedEntry)
        {
            var qualifierValue     = QualifierValue.Create(qualifier, context.QualifierValueCache, context.FrontEndContext.QualifierTable, context.StringTable);
            var instantiatedModule = InstantiateFileModuleLiteral(context.ModuleRegistry, qualifierValue);

            if (resolvedEntry.Thunk == null)
            {
                return(instantiatedModule.EvaluateNonThunkedResolvedSymbol(context, instantiatedModule, resolvedEntry));
            }

            var name = resolvedEntry.ThunkContextName;

            return(instantiatedModule.EvaluateByLocation(context, filePosition, name, resolvedEntry.Location));
        }
Ejemplo n.º 2
0
        private async Task <object> EvaluateResolverCallback(Context context, QualifierId qualifier, FilePosition filePosition, ResolvedEntry resolvedEntry)
        {
            var qualifierValue = QualifierValue.Create(qualifier, context.QualifierValueCache, context.FrontEndContext.QualifierTable, context.StringTable);
            var env            = InstantiateFileModuleLiteral(context.ModuleRegistry, qualifierValue);

            using (var args = EvaluationStackFrame.Empty())
            {
                return(await resolvedEntry.ResolverCallback(context, env, args));
            }
        }
Ejemplo n.º 3
0
        private Task <object> GetEvaluateResolvedEntryTaskAsync(Context context, QualifierId qualifier, FilePosition filePosition, ResolvedEntry resolvedEntry)
        {
            if (resolvedEntry.ResolverCallback != null)
            {
                return(context.EvaluationScheduler.EvaluateValue(() => EvaluateResolverCallback(context, qualifier, filePosition, resolvedEntry)));
            }

            return(context.EvaluationScheduler.EvaluateValue(
                       () => Task.FromResult(EvaluateResolvedEntry(context, qualifier, filePosition, resolvedEntry).Value)));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns resolved entry by position.
 /// </summary>
 /// <remarks>
 /// Implemented in <see cref="FileModuleLiteral"/>.
 /// </remarks>
 public virtual bool TryGetResolvedEntry(ModuleRegistry moduleRegistry, FilePosition location, out ResolvedEntry resolvedEntry, out FileModuleLiteral resolvedModule)
 {
     resolvedEntry  = default(ResolvedEntry);
     resolvedModule = null;
     return(false);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Stores a given resolved entry at a given location.
 /// </summary>
 public virtual void AddResolvedEntry(FilePosition location, ResolvedEntry entry)
 {
     CurrentFileModule?.AddResolvedEntry(location, entry);
 }
Ejemplo n.º 6
0
        // Following set of methods are used in V2 name resolution based on a semantic information from the checker.

        /// <summary>
        /// Stores a given function at a given location.
        /// </summary>
        public virtual void AddResolvedEntry(FilePosition location, FunctionLikeExpression lambda)
        {
            CurrentFileModule?.AddResolvedEntry(location, lambda);
        }