Open
Description
The front-end lowering of late variables is too large for dart2js (see #43361) and DDC.
One of the reasons is that the lowering contains comprehensive error messages.
These could be factored so that the call to the error contains only the name, and the rest of the message is provided by the constructor.
Instead of:
throw LateInitializationErrorImpl("Field 'queryParameters' has been assigned during initialization.");
throw LateInitializationErrorImpl("Local 'result' has not been initialized.");
generate:
throw LateInitializationErrorImpl.fieldAssignedDuringInitialization('queryParameters');
throw LateInitializationErrorImpl.localNotInitialized('result');
There should also be a target configuration option to omit the names as the name can be guessed from the stack-trace.
For the best code from dart2js, the LateInitializationErrorImpl
constructor without the name should be a separate named constructor (not an optional name argument, as the default occurs at the call site).
/cc @johnniwinther