Skip to content

Commit 20dfdf2

Browse files
chore(sync): mirror internal packages into pkg/ (auto) (#64)
Co-authored-by: buke <1013738+buke@users.noreply.github.com>
1 parent 8c7c563 commit 20dfdf2

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

pkg/checker/checker.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,8 +2302,8 @@ func (c *Checker) checkSourceElementUnreachable(node *ast.Node) bool {
23022302

23032303
sourceFile := ast.GetSourceFileOfNode(node)
23042304

2305-
start := node.Pos()
2306-
end := node.End()
2305+
startNode := node
2306+
endNode := node
23072307

23082308
parent := node.Parent
23092309
if parent.CanHaveStatements() {
@@ -2333,14 +2333,14 @@ func (c *Checker) checkSourceElementUnreachable(node *ast.Node) bool {
23332333
c.reportedUnreachableNodes.Add(nextNode)
23342334
}
23352335

2336-
start = statements[first].Pos()
2337-
end = statements[last].End()
2336+
startNode = statements[first]
2337+
endNode = statements[last]
23382338
}
23392339
}
23402340

2341-
start = scanner.SkipTrivia(sourceFile.Text(), start)
2341+
start := scanner.GetTokenPosOfNode(startNode, sourceFile, false /*includeJSDoc*/)
23422342

2343-
diagnostic := ast.NewDiagnostic(sourceFile, core.NewTextRange(start, end), diagnostics.Unreachable_code_detected)
2343+
diagnostic := ast.NewDiagnostic(sourceFile, core.NewTextRange(start, endNode.End()), diagnostics.Unreachable_code_detected)
23442344
c.addErrorOrSuggestion(c.compilerOptions.AllowUnreachableCode == core.TSFalse, diagnostic)
23452345

23462346
return true

pkg/pprof/pprof.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"os"
77
"path/filepath"
88
"runtime/pprof"
9-
10-
"github.com/buke/typescript-go-internal/pkg/repo"
119
)
1210

1311
type ProfileSession struct {
@@ -63,12 +61,3 @@ func (p *ProfileSession) Stop() {
6361
fmt.Fprintf(p.logWriter, "CPU profile: %v\n", p.cpuFilePath)
6462
fmt.Fprintf(p.logWriter, "Memory profile: %v\n", p.memFilePath)
6563
}
66-
67-
// ProfileInPprofDir is a convenience function that starts profiling in the 'pprof' directory under the repository root.
68-
// The resulting files are logged to stderr. It returns a function that stops the profiling when called.
69-
func ProfileInPprofDir() func() {
70-
session := BeginProfiling(filepath.Join(repo.RootPath, "pprof"), os.Stderr)
71-
return func() {
72-
session.Stop()
73-
}
74-
}

0 commit comments

Comments
 (0)