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; } }
/// <summary> /// Creates a mutable named child context. /// </summary> /// <remarks> /// Until all mutable child contexts have been disposed, no mutations are allowed on the current context. /// </remarks> public Context CreateWithName(Thunk activeThunk, FullSymbol name, ModuleLiteral module, object templateValue, LineInfo location) { Contract.Requires(name.IsValid); Contract.Requires(module != null); var topLevelValueState = new TopLevelValueInfo( activeThunk, name, module.Path, location, templateValue); return(new Context( ContextTree, this, module, topLevelValueState, FileType, EvaluatorConfiguration, EvaluationScheduler)); }