diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-11-27 21:25:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-11-27 21:25:58 +0000 |
commit | 80d7d30d2483025baff22fde3b36ea227639a4e7 (patch) | |
tree | abd27ec71178b8971e095339295317307192a8e3 /libgo | |
parent | 010211394dc2da35487ee0ce9e9f6cb13f343051 (diff) | |
download | gcc-80d7d30d2483025baff22fde3b36ea227639a4e7.zip gcc-80d7d30d2483025baff22fde3b36ea227639a4e7.tar.gz gcc-80d7d30d2483025baff22fde3b36ea227639a4e7.tar.bz2 |
compiler: add '$' to names in expression export data
For inlined function bodies we're going to need to refer to variables,
so change the existing export data to add a '$' to names that look
like identifiers: true, false, nil, convert.
While we're here drop an unnecessary space character after operators.
Reviewed-on: https://go-review.googlesource.com/c/150067
From-SVN: r266529
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/go/internal/gccgoimporter/parser.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libgo/go/go/internal/gccgoimporter/parser.go b/libgo/go/go/internal/gccgoimporter/parser.go index c23002f..6f01010 100644 --- a/libgo/go/go/internal/gccgoimporter/parser.go +++ b/libgo/go/go/internal/gccgoimporter/parser.go @@ -282,6 +282,15 @@ func (p *parser) parseConversion(pkg *types.Package) (val constant.Value, typ ty // ConstValue = string | "false" | "true" | ["-"] (int ["'"] | FloatOrComplex) | Conversion . // FloatOrComplex = float ["i" | ("+"|"-") float "i"] . func (p *parser) parseConstValue(pkg *types.Package) (val constant.Value, typ types.Type) { + // v3 changed to $false, $true, $convert, to avoid confusion + // with variable names in inline function bodies. + if p.tok == '$' { + p.next() + if p.tok != scanner.Ident { + p.errorf("expected identifer after '$', got %s (%q)", scanner.TokenString(p.tok), p.lit) + } + } + switch p.tok { case scanner.String: str := p.parseString() |