mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
Update error.cpp
This commit is contained in:
parent
d2052557f7
commit
1cf67220f8
@ -26,7 +26,7 @@ namespace pkpy{
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::pair<const char*,const char*> SourceData::_get_line(int lineno) const {
|
std::pair<const char*,const char*> SourceData::_get_line(int lineno) const {
|
||||||
if(lineno == -1) return {nullptr, nullptr};
|
if(is_precompiled || lineno == -1) return {nullptr, nullptr};
|
||||||
lineno -= 1;
|
lineno -= 1;
|
||||||
if(lineno < 0) lineno = 0;
|
if(lineno < 0) lineno = 0;
|
||||||
const char* _start = line_starts[lineno];
|
const char* _start = line_starts[lineno];
|
||||||
@ -40,7 +40,7 @@ namespace pkpy{
|
|||||||
SStream ss;
|
SStream ss;
|
||||||
ss << " " << "File \"" << filename << "\", line " << lineno;
|
ss << " " << "File \"" << filename << "\", line " << lineno;
|
||||||
if(!name.empty()) ss << ", in " << name;
|
if(!name.empty()) ss << ", in " << name;
|
||||||
if(!source.empty() && !is_precompiled){
|
if(!is_precompiled){
|
||||||
ss << '\n';
|
ss << '\n';
|
||||||
std::pair<const char*,const char*> pair = _get_line(lineno);
|
std::pair<const char*,const char*> pair = _get_line(lineno);
|
||||||
Str line = "<?>";
|
Str line = "<?>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user