summaryrefslogtreecommitdiff
path: root/mk2rbc/variable.go
diff options
context:
space:
mode:
author Sasha Smundak <asmundak@google.com> 2021-11-11 18:31:59 -0800
committer Sasha Smundak <asmundak@google.com> 2021-11-18 10:01:37 -0800
commit422b614355c0dcbad5d4b989d52fa0b1db252821 (patch)
tree2416a6cca652356be571d7a2dbb3c16295dd9e55 /mk2rbc/variable.go
parentd679785d0d52526e1f86580072771aabfc466f6c (diff)
Generate runtime conversion diagnostics
Instead of inserting a comment with error description into the generated code, generate a call to a function that will print out a conversion error when executed. Do not print generic "partially converted" message anymore. Remove --verbose and --no_warnings options. Bug: 204062171 Test: internal Change-Id: Ib126e16dc76f49635e4939e670922f2561781049
Diffstat (limited to 'mk2rbc/variable.go')
-rw-r--r--mk2rbc/variable.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/mk2rbc/variable.go b/mk2rbc/variable.go
index ded07fed6..6b67a7cb9 100644
--- a/mk2rbc/variable.go
+++ b/mk2rbc/variable.go
@@ -228,10 +228,9 @@ func (pv predefinedVariable) emitSet(gctx *generationContext, asgn *assignmentNo
if actualValue == expectedValue {
return
}
- gctx.writef("# MK2RBC TRANSLATION ERROR: cannot set predefined variable %s to %q, its value should be %q",
- pv.name(), actualValue, expectedValue)
- gctx.newLine()
- gctx.write("pass")
+ gctx.emitConversionError(asgn.location,
+ fmt.Sprintf("cannot set predefined variable %s to %q, its value should be %q",
+ pv.name(), actualValue, expectedValue))
gctx.starScript.hasErrors = true
return
}