LGTM - gri On Mon, Dec 27, 2010 at 9:11 AM, <seb.binet@gmail.com> wrote: > Reviewers: ...
14 years, 10 months ago
(2010-12-27 18:05:15 UTC)
#2
LGTM
- gri
On Mon, Dec 27, 2010 at 9:11 AM, <seb.binet@gmail.com> wrote:
> Reviewers: golang-dev_googlegroups.com,
>
> Message:
> Hello golang-dev@googlegroups.com (cc: binet@cern.ch,
> golang-dev@googlegroups.com),
>
> I'd like you to review this change.
>
>
> Description:
> simple fix to not have 'exp/eval' panic in presence of slices like s[:2]
>
> Please review this at http://codereview.appspot.com/3782044/
>
> Affected files:
> M src/pkg/exp/eval/expr.go
>
>
> Index: src/pkg/exp/eval/expr.go
> ===================================================================
> --- a/src/pkg/exp/eval/expr.go
> +++ b/src/pkg/exp/eval/expr.go
> @@ -595,9 +595,15 @@
> return ei.compileIndexExpr(l, r)
>
> case *ast.SliceExpr:
> - var hi *expr
> + var lo, hi *expr
> arr := a.compile(x.X, false)
> - lo := a.compile(x.Index, false)
> + if x.Index == nil {
> + // beginning was omitted, so we need to provide it
> + ei := &exprInfo{a.compiler, x.Pos()}
> + lo = ei.compileIntLit("0")
> + } else {
> + lo = a.compile(x.Index, false)
> + }
> if x.End == nil {
> // End was omitted, so we need to compute len(x.X)
> ei := &exprInfo{a.compiler, x.Pos()}
>
>
>
Issue 3782044: code review 3782044: simple fix to not have 'exp/eval' panic in presence of ...
(Closed)
Created 14 years, 10 months ago by binet
Modified 14 years, 10 months ago
Reviewers:
Base URL:
Comments: 0