fix: Phase 2 — HIGH #6,9,10,11,12,19,23,32,46,47
Files modified (5):
compiler/gengo/gengo.go — #6,#32: Deduplicate 3 Generate functions into 1
doGenerate(file, debug, library) replaces 170 lines of copy-paste
Dead GenerateDebug method removed
cmd/five/main.go — #9,10,11,12: Fix 5 silently ignored errors
filepath.Abs, tidy.Run, tidyCmd.CombinedOutput now checked
hbrtl/strings.go — #19: Str() now reads caller's nWidth/nDec params
Was ignoring explicit Str(123, 10, 2) arguments
compiler/pp/pp.go — #46: Fix stale "NOT implemented" comment
#47: Extract maxIncludeDepth constant
compiler/lexer/lexer.go — #23: Remove unused LookupKeyword result
Issues resolved: 10 (HIGH: 7, MEDIUM: 3)
Total fixed: 26/53
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,8 @@ import (
|
||||
// Str converts a numeric value to a string.
|
||||
// Harbour: Str(nValue [, nWidth [, nDec]]) → cString
|
||||
func Str(t *hbrt.Thread) {
|
||||
t.Frame(1, 0) // at least 1 param
|
||||
nParams := t.ParamCount()
|
||||
t.Frame(nParams, 0)
|
||||
defer t.EndProc()
|
||||
|
||||
v := t.Local(1)
|
||||
@@ -26,9 +27,18 @@ func Str(t *hbrt.Thread) {
|
||||
}
|
||||
|
||||
d := v.AsNumDouble()
|
||||
|
||||
// Width and decimals: use caller's args if provided, else Value metadata
|
||||
width := int(v.Length())
|
||||
dec := int(v.Decimal())
|
||||
|
||||
if nParams >= 2 && !t.Local(2).IsNil() {
|
||||
width = t.Local(2).AsInt()
|
||||
}
|
||||
if nParams >= 3 && !t.Local(3).IsNil() {
|
||||
dec = t.Local(3).AsInt()
|
||||
}
|
||||
|
||||
if width == 0 || width == 255 {
|
||||
width = 10 // default width
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user