diff --git a/microsoft/typescript-go b/microsoft/typescript-go index c15e7649c..d9178cc1f 160000 --- a/microsoft/typescript-go +++ b/microsoft/typescript-go @@ -1 +1 @@ -Subproject commit c15e7649ca152ac52d424558abae7addd3f43801 +Subproject commit d9178cc1fef3cedc3c1a48a652e63dd83310ea20 diff --git a/pkg/checker/checker.go b/pkg/checker/checker.go index 97d7cfc06..5e5f08deb 100644 --- a/pkg/checker/checker.go +++ b/pkg/checker/checker.go @@ -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() { @@ -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 diff --git a/pkg/pprof/pprof.go b/pkg/pprof/pprof.go index 554e7110f..2523c9488 100644 --- a/pkg/pprof/pprof.go +++ b/pkg/pprof/pprof.go @@ -6,8 +6,6 @@ import ( "os" "path/filepath" "runtime/pprof" - - "github.com/buke/typescript-go-internal/pkg/repo" ) type ProfileSession struct { @@ -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() - } -}