platform_build_blueprint/parser
Sasha Smundak 77418b70b4 Fix null pointer dereference printing an expression.
Parser.parseVariable method should always set the value of the variable
it creates. Failure to do so may end up in the following:

```
$ androidmk  <(printf "FOO:=(X)\nFOO:=bar\n")
parse error:
<input>:3:1: variable already set, previous assignment: FOO@<input>:1:5 = %!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference) (%!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference)) false
```

The cause is that calling Parser.Parse to parse `FOO=abc` created
a Variable instance with nil value, causing panic on print attempt.

Test: m androidmk && androidmk  <(printf "FOO:=(X)\nFOO:=bar\n")
(should print:
ERROR:  parse error:
<input>:3:1: variable already set, previous assignment: FOO@<input>:1:5 = X = Not Evaluated (X = Not Evaluated) false)

Change-Id: I296d7984df6d8796e0075f9eb692b234f8c94f08
2020-01-23 13:32:43 -08:00
..
ast.go Fix null pointer dereference printing an expression. 2020-01-23 13:32:43 -08:00
modify.go Add Patch and PatchList for making textual changes 2018-04-10 16:50:39 -07:00
modify_test.go Add Patch and PatchList for making textual changes 2018-04-10 16:50:39 -07:00
parser.go Fix null pointer dereference printing an expression. 2020-01-23 13:32:43 -08:00
parser_test.go Fix null pointer dereference printing an expression. 2020-01-23 13:32:43 -08:00
printer.go Improve indentation for multi-line expressions 2018-05-07 16:15:33 -07:00
printer_test.go Emit errors on mixed property syntax 2018-06-26 12:20:08 +08:00
sort.go Add CommentGroups 2016-06-14 15:26:49 -07:00