[VM/libraries] - Fix issues in ported patch files that cause dart2js to fail (https://github.com/dart-lang/sdk/issues/40463)

- List<String> should be List<Object?> because entries in the stack can be either Map or Strings
- _divRem has some cached values which are marked late but are used
before they are initialized resulting in exceptions, these four cached
values are now made nullable.

Bug: 40463
Change-Id: I469692e95bf6ef74665d14209dd3e2cd556c1f06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134408
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
asiva 2020-02-04 23:43:27 +00:00 committed by commit-bot@chromium.org
parent d798004ba3
commit 1f32305392
2 changed files with 6 additions and 6 deletions

View file

@ -107,10 +107,10 @@ class _BigIntImpl implements BigInt {
new bool.fromEnvironment('dart.vm.not.a.compile.time.constant');
// Result cache for last _divRem call.
static late Uint32List _lastDividendDigits;
static late int _lastDividendUsed;
static late Uint32List _lastDivisorDigits;
static late int _lastDivisorUsed;
static Uint32List? _lastDividendDigits;
static int? _lastDividendUsed;
static Uint32List? _lastDivisorDigits;
static int? _lastDivisorUsed;
static late Uint32List _lastQuoRemDigits;
static late int _lastQuoRemUsed;
static late int _lastRemUsed;

View file

@ -115,7 +115,7 @@ class _BuildJsonListener extends _JsonListener {
* started. If the container is a [Map], there is also a current [key]
* which is also stored on the stack.
*/
final List<String> stack = <String>[];
final List<Object?> stack = [];
/** The current [Map] or [List] being built. */
var currentContainer;
/** The most recently read property key. */
@ -133,7 +133,7 @@ class _BuildJsonListener extends _JsonListener {
void popContainer() {
value = currentContainer;
currentContainer = stack.removeLast();
if (currentContainer is Map) key = stack.removeLast();
if (currentContainer is Map) key = stack.removeLast() as String;
}
void handleString(String value) {