Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion microsoft/typescript-go
12 changes: 6 additions & 6 deletions pkg/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2302,8 +2302,8 @@ func (c *Checker) checkSourceElementUnreachable(node *ast.Node) bool {

sourceFile := ast.GetSourceFileOfNode(node)

start := node.Pos()
end := node.End()
startNode := node
endNode := node

parent := node.Parent
if parent.CanHaveStatements() {
Expand Down Expand Up @@ -2333,14 +2333,14 @@ func (c *Checker) checkSourceElementUnreachable(node *ast.Node) bool {
c.reportedUnreachableNodes.Add(nextNode)
}

start = statements[first].Pos()
end = statements[last].End()
startNode = statements[first]
endNode = statements[last]
}
}

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

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

return true
Expand Down
11 changes: 0 additions & 11 deletions pkg/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"os"
"path/filepath"
"runtime/pprof"

"github.com/buke/typescript-go-internal/pkg/repo"
)

type ProfileSession struct {
Expand Down Expand Up @@ -63,12 +61,3 @@ func (p *ProfileSession) Stop() {
fmt.Fprintf(p.logWriter, "CPU profile: %v\n", p.cpuFilePath)
fmt.Fprintf(p.logWriter, "Memory profile: %v\n", p.memFilePath)
}

// ProfileInPprofDir is a convenience function that starts profiling in the 'pprof' directory under the repository root.
// The resulting files are logged to stderr. It returns a function that stops the profiling when called.
func ProfileInPprofDir() func() {
session := BeginProfiling(filepath.Join(repo.RootPath, "pprof"), os.Stderr)
return func() {
session.Stop()
}
}