blob: 20db53d209e30fd4e69cf8dea6f64d92bc6287a8 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
static method test2() void {
core::String* string = null;
if(let final core::String* #t1 = string in #t1.{core::String::==}(null) ?{core::bool*} null : #t1.{core::String::isNotEmpty})
;
}
static method main() void {
try {
self::test2();
}
on dynamic catch(final dynamic e, final core::StackTrace* s) {
self::checkFirstLineHasPosition(s);
}
}
static method checkFirstLineHasPosition(core::StackTrace* stackTrace) void {
core::String* firstLine = "${stackTrace}".{core::String::split}("
").{core::Iterable::firstWhere}((core::String* line) core::bool* => line.{core::String::startsWith}("#0"));
core::int* lastParen = firstLine.{core::String::lastIndexOf}(")");
if(!lastParen.{core::num::==}(1.{core::int::unary-}())) {
core::int* secondColon = firstLine.{core::String::lastIndexOf}(":", lastParen.{core::num::-}(1));
if(!secondColon.{core::num::==}(1.{core::int::unary-}())) {
core::int* firstColon = firstLine.{core::String::lastIndexOf}(":", secondColon.{core::num::-}(1));
core::String* lineText = firstLine.{core::String::substring}(firstColon.{core::num::+}(1), secondColon);
core::String* posText = firstLine.{core::String::substring}(secondColon.{core::num::+}(1), lastParen);
core::int* line = core::int::tryParse(lineText);
core::int* pos = core::int::tryParse(posText);
if(!line.{core::num::==}(null) && !pos.{core::num::==}(null)) {
core::print("Found position ${line}:${pos}");
return;
}
}
}
throw "No position found in \"${firstLine}\"";
}