step method
void
step()
Implementation
void step() {
if (stack.isEmpty) return; // not even a global context
stopwatch ??= Stopwatch();
stopwatch!.start();
var context = stack.last;
while (context.done) {
if (stack.length == 1) return; // all done (can't pop the global context)
popContext();
context = stack.last;
}
final line = context.code[context.lineNum++];
try {
doOneLine(line, context);
} on MiniscriptException catch (e) {
e.location ??= line.location;
if (e.location == null) {
for (final ctx in [...stack, context]) {
if (ctx.lineNum >= ctx.code.length) continue;
e.location = ctx.code[ctx.lineNum].location;
if (e.location != null) break;
}
}
rethrow;
}
stopwatch!.stop();
}