internal ImmutableContextBase( ContextTree contextTree, ImmutableContextBase parent, [NotNull] ModuleLiteral module, TopLevelValueInfo topLevelValueInfo, FileType fileType, EvaluatorConfiguration configuration, [NotNull] IEvaluationScheduler evaluationScheduler) { Contract.Requires(contextTree.IsValid); Contract.Requires(parent == null || parent.ContextTree == contextTree); Contract.Requires(module != null); Contract.Requires(evaluationScheduler != null); ParentContext = parent; LastActiveUsedModule = module; TopLevelValueInfo = topLevelValueInfo; ContextTree = contextTree; DebugState = new DebugState(); m_relativePath = RelativePath.Invalid; EvaluatorConfiguration = configuration; EvaluationScheduler = evaluationScheduler; FileType = fileType; if (parent != null) { m_callStack = parent.m_callStack; } }
internal DisplayStackTraceEntry CreateDisplayStackTraceEntry(ImmutableContextBase context, LineInfo lastCallSite) { if (m_ambientCall != null) { var loc = new Location { File = "[ambient call]", Line = -1, Position = -1 }; var functionName = m_ambientCall.Functor.ToDisplayString(context); return(new DisplayStackTraceEntry(loc, functionName, this)); } if (Lambda != null) { var location = lastCallSite.AsLoggingLocation(Env, context); SymbolAtom?methodName = Lambda?.Name; var functionName = methodName?.IsValid == true?methodName.Value.ToString(context.StringTable) : "<lambda>"; return(new DisplayStackTraceEntry(location, functionName, this)); } throw Contract.AssertFailure("The code is effectively unreacheable."); }
/// <summary> /// Returns string representation of the first part of an error. /// </summary> public string ErrorReceiverAsString(ImmutableContextBase context) { return(new DisplayStringHelper(context).ErrorReceiverAsString(this)); }
/// <nodoc /> public EvaluationErrors(ImmutableContextBase context) { Contract.Requires(context != null); Context = context; }
/// <summary> /// Returns string representation of the error. /// </summary> public string ToErrorString(ImmutableContextBase context) { return(new DisplayStringHelper(context).ToErrorString(this)); }