Work around flow analysis bug (#59)

Flow analysis currently has a bug preventing for-each loop variables
from being properly promoted in the presence of closures
(https://github.com/dart-lang/sdk/issues/43136); as a result of this
bug the source_span package had two non-null assertions that ought to
have been unnecessary.

I'm preparing a fix for that bug, however if I land it as is, it will
cause the front end to emit errors saying "Operand of null-aware
operation '!' has type '_Highlight' which excludes null"; this in turn
will cause SDK bot breakages (since source_span is imported into the
SDK repo).

So, in order to land the fix, we need to first update the source_span
package to work around the bug; this change does that by allocating a
temporary variable (which *is* promoted correctly).

Once the fix for https://github.com/dart-lang/sdk/issues/43136 lands,
I will make a follow-up change that deletes the temporary variable.
1 file changed
tree: 47d295aefc23ba187cc93a92fc4505bfd7002f04
  1. lib/
  2. test/
  3. .gitignore
  4. .travis.yml
  5. analysis_options.yaml
  6. CHANGELOG.md
  7. LICENSE
  8. pubspec.yaml
  9. README.md
README.md

source_span is a library for tracking locations in source code. It's designed to provide a standard representation for source code locations and spans so that disparate packages can easily pass them among one another, and to make it easy to generate human-friendly messages associated with a given piece of code.

The most commonly-used class is the package's namesake, SourceSpan. It represents a span of characters in some source file, and is often attached to an object that has been parsed to indicate where it was parsed from. It provides access to the text of the span via SourceSpan.text and can be used to produce human-friendly messages using SourceSpan.message().

When parsing code from a file, SourceFile is useful. Not only does it provide an efficient means of computing line and column numbers, SourceFile.span() returns special FileSpans that are able to provide more context for their error messages.