Remove check.FlagsOnlyTypeCheck.

The puffs-gen-foo commands might need to bounds check anyway, to e.g.
generate different code paths depending on whether a u64 typed
expression fits in a usize's range.
This commit is contained in:
Nigel Tao committed 2017-06-18 09:17:58 +10:00
1 parent ae20422754
commit 6904068251
4 files changed
+14 -40

No files matched your search

+1 -10
View File
@@ -16,9 +16,6 @@ import (
)
var (
assumeAlreadyChecked = flag.Bool("assume_already_checked", false,
"whether to skip bounds-checking; unsafe unless some other program checks the inputs")
packageName = flag.String("package_name", "", "the package name of the Puffs input code")
)
@@ -41,13 +38,7 @@ func main1(g Generator) error {
return err
}
// Even if we can skip the bounds-checking, we still need to type-check to
// evaluate e.g. the constant N expression in the type "[N]u8".
checkFlags := check.Flags(0)
if *assumeAlreadyChecked {
checkFlags |= check.FlagsOnlyTypeCheck
}
if _, err := check.Check(tm, checkFlags, files...); err != nil {
if _, err := check.Check(tm, files...); err != nil {
return err
}