commit | 3960cacc89e5b440931c5a45f84b674ba9c7425a | [log] [tgz] |
---|---|---|
author | Brian Wilkerson <brianwilkerson@google.com> | Wed May 23 13:11:56 2018 +0000 |
committer | commit-bot@chromium.org <commit-bot@chromium.org> | Wed May 23 13:11:56 2018 +0000 |
tree | e93b3117abbd191745fa8486e0a6e1540428d55a | |
parent | 3582e30d8ec4b0cf8c2768d2c628a4be819ba5c6 [diff] |
Make peek return null when the stack is empty Change-Id: I73cea25140ad1123ff1a8cb1bca1c69742d3d6f7 Reviewed-on: https://dart-review.googlesource.com/56201 Reviewed-by: Dan Rubel <danrubel@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener.dart b/pkg/front_end/lib/src/fasta/source/stack_listener.dart index f312680..ef9eda1 100644 --- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart +++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -111,7 +111,7 @@ if (tokenOrNull == null) stack.push(nullValue); } - Object peek() => stack.last; + Object peek() => stack.isNotEmpty ? stack.last : null; Object pop([NullValue nullValue]) { return stack.pop(nullValue);