Skip to content

Commit

Permalink
internal/filetypes: split ParseFile
Browse files Browse the repository at this point in the history
Exposing ParseFileAndType. For the embedding
proposal, file and type are specfied separately
and do not need to be parsed as on the
command line.

Issue #2031

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ib02f845d503edf1d78834a1ff2a0c224cc936748
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196716
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
  • Loading branch information
mpvl committed Jun 25, 2024
1 parent f42327c commit a1c1cd7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/filetypes/filetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ func ParseFile(s string, mode Mode) (*build.File, error) {
}
return nil, errors.Newf(token.NoPos, "empty file name")
}

return ParseFileAndType(file, scope, mode)
}

// ParseFileAndType parses a file and type combo.
func ParseFileAndType(file, scope string, mode Mode) (*build.File, error) {
// Quickly discard files which we aren't interested in.
// These cases are very common when loading `./...` in a large repository.
typesInit()
Expand Down

0 comments on commit a1c1cd7

Please sign in to comment.