mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
Update error.h
This commit is contained in:
parent
0e6b8ab61b
commit
1be6d72a97
@ -30,6 +30,7 @@ struct SourceMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SourceMetadata(const char* source, _Str filename, CompileMode mode) {
|
SourceMetadata(const char* source, _Str filename, CompileMode mode) {
|
||||||
|
source = strdup(source);
|
||||||
// Skip utf8 BOM if there is any.
|
// Skip utf8 BOM if there is any.
|
||||||
if (strncmp(source, "\xEF\xBB\xBF", 3) == 0) source += 3;
|
if (strncmp(source, "\xEF\xBB\xBF", 3) == 0) source += 3;
|
||||||
this->filename = filename;
|
this->filename = filename;
|
||||||
@ -46,6 +47,10 @@ struct SourceMetadata {
|
|||||||
ss << " " << line << '\n';
|
ss << " " << line << '\n';
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~SourceMetadata(){
|
||||||
|
free((void*)source);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<SourceMetadata> _Source;
|
typedef std::shared_ptr<SourceMetadata> _Source;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user