Commit 31480fb9 authored by Damien George's avatar Damien George

py/frozenmod: Pass the source name of the frozen module to the lexer.

This allows for better error messages, since the name of the file (sans
.py) can now be printed when an exception occurs within a frozen script.
parent 5e247a51
......@@ -50,7 +50,8 @@ STATIC mp_lexer_t *mp_find_frozen_str(const char *str, size_t len) {
for (int i = 0; *name != 0; i++) {
size_t l = strlen(name);
if (l == len && !memcmp(str, name, l)) {
mp_lexer_t *lex = MICROPY_MODULE_FROZEN_LEXER(MP_QSTR_, mp_frozen_str_content + offset, mp_frozen_str_sizes[i], 0);
qstr source = qstr_from_strn(name, l);
mp_lexer_t *lex = MICROPY_MODULE_FROZEN_LEXER(source, mp_frozen_str_content + offset, mp_frozen_str_sizes[i], 0);
return lex;
}
name += l + 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment