Skip to content

Commit

Permalink
[benchmark] Make BigIntPrintParse be NNBD-agnostic
Browse files Browse the repository at this point in the history
Change-Id: I6e93972bf904cbf09316517798a43116ee7fa61a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141027
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
  • Loading branch information
rakudrama authored and commit-bot@chromium.org committed Mar 26, 2020
1 parent 12e81d3 commit 93c2900
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
26 changes: 12 additions & 14 deletions benchmarks/BigIntParsePrint/dart/native_version_dummy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ class _DummyMethods implements NativeBigIntMethods {

bool get enabled => false;

static Object bad(String message) {
throw UnimplementedError(message);
}
static Object bad(String message) => UnimplementedError(message);

Object parse(String string) => bad('parse');
String toStringMethod(Object value) => bad('toStringMethod');
Object parse(String string) => throw bad('parse');
String toStringMethod(Object value) => throw bad('toStringMethod');

Object fromInt(int i) => bad('fromInt');
Object fromInt(int i) => throw bad('fromInt');

Object get one => bad('one');
Object get eight => bad('eight');
Object get one => throw bad('one');
Object get eight => throw bad('eight');

int bitLength(Object value) => bad('bitLength');
bool isEven(Object value) => bad('isEven');
int bitLength(Object value) => throw bad('bitLength');
bool isEven(Object value) => throw bad('isEven');

Object add(Object left, Object right) => bad('add');
Object shiftLeft(Object value, Object count) => bad('shiftLeft');
Object shiftRight(Object value, Object count) => bad('shiftRight');
Object subtract(Object left, Object right) => bad('subtract');
Object add(Object left, Object right) => throw bad('add');
Object shiftLeft(Object value, Object count) => throw bad('shiftLeft');
Object shiftRight(Object value, Object count) => throw bad('shiftRight');
Object subtract(Object left, Object right) => throw bad('subtract');
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@ void _setup() {
_eval('self.bigint_isEven = function isEven(b) { return (b & 1n) == 0n; }');
}

Object _one;
Object _eight;
// `dynamic` to allow null initialization pre- and post- NNBD.
dynamic _one;
dynamic _eight;

0 comments on commit 93c2900

Please sign in to comment.