MCPcopy Create free account
hub / github.com/microsoft/typescript-go / GetSourceFile

Method GetSourceFile

internal/execute/watcher.go:34–55  ·  view source on GitHub ↗
(opts ast.SourceFileParseOptions)

Source from the content-addressed store, hash-verified

32}
33
34func (h *watchCompilerHost) GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile {
35 info := h.CompilerHost.FS().Stat(opts.FileName)
36
37 if cached, ok := h.cache.Load(opts.Path); ok {
38 if info != nil && info.ModTime().Equal(cached.modTime) {
39 return cached.file
40 }
41 }
42
43 file := h.CompilerHost.GetSourceFile(opts)
44 if file != nil {
45 if info != nil {
46 h.cache.Store(opts.Path, &cachedSourceFile{
47 file: file,
48 modTime: info.ModTime(),
49 })
50 }
51 } else {
52 h.cache.Delete(opts.Path)
53 }
54 return file
55}
56
57type Watcher struct {
58 sys tsc.System

Callers

nothing calls this directly

Calls 8

EqualMethod · 0.80
ModTimeMethod · 0.80
StoreMethod · 0.80
StatMethod · 0.65
FSMethod · 0.65
GetSourceFileMethod · 0.65
DeleteMethod · 0.65
LoadMethod · 0.45

Tested by

no test coverage detected