mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Minor changes with ValueTypeError, Skylark: Fixed issue with witz error line number
git-svn-id: svn://ultimatepp.org/upp/trunk@7243 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
592008a677
commit
ca1a7bf19a
5 changed files with 17 additions and 24 deletions
|
|
@ -790,3 +790,9 @@ inline void __LOGF__(const char *format, ...);
|
|||
|
||||
template <class T>
|
||||
void IGNORE_RESULT(const T&) {}
|
||||
|
||||
class Exc : public String {
|
||||
public:
|
||||
Exc() {}
|
||||
Exc(const String& desc) : String(desc) {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,14 +8,8 @@ const Nuller Null;
|
|||
|
||||
#define LTIMING(x) // RTIMING(x)
|
||||
|
||||
void ThrowValueTypeError(const String& text, const Value& src, int target)
|
||||
{
|
||||
ValueTypeError err;
|
||||
(String&)err = text;
|
||||
err.src = text;
|
||||
err.target = target;
|
||||
throw err;
|
||||
}
|
||||
ValueTypeError::ValueTypeError(const String& text, const Value& src, int target)
|
||||
: Exc(text), src(src), target(target) {}
|
||||
|
||||
unsigned Value::GetOtherHashValue() const {
|
||||
if(IsNull())
|
||||
|
|
|
|||
|
|
@ -74,14 +74,6 @@ class AssignValueTypeNo : public ValueType<T, type, B> {};
|
|||
template <class T>
|
||||
dword GetValueTypeNo() { return ValueTypeNo((T*)NULL); }
|
||||
|
||||
class Exc : public String {
|
||||
public:
|
||||
Exc() {}
|
||||
Exc(const String& desc) : String(desc) {}
|
||||
};
|
||||
|
||||
void ThrowValueTypeError(const String& text, const Value& src, int target);
|
||||
|
||||
class Value : Moveable_<Value> {
|
||||
public:
|
||||
class Void {
|
||||
|
|
@ -271,6 +263,8 @@ public:
|
|||
struct ValueTypeError : Exc {
|
||||
Value src;
|
||||
int target;
|
||||
|
||||
ValueTypeError(const String& text, const Value& src, int target);
|
||||
};
|
||||
|
||||
template <class T> bool FitsSvoValue() { return sizeof(T) <= 8; }
|
||||
|
|
|
|||
|
|
@ -204,9 +204,9 @@ T& Value::GetSmall() const
|
|||
ASSERT(t < 255);
|
||||
if(Is((byte)t))
|
||||
return GetSmallRaw<T>();
|
||||
ThrowValueTypeError(String().Cat() << "Invalid value conversion: "
|
||||
<< GetName() << " -> " << typeid(T).name(),
|
||||
*this, t);
|
||||
throw ValueTypeError(String().Cat() << "Invalid value conversion: "
|
||||
<< GetName() << " -> " << typeid(T).name(),
|
||||
*this, t);
|
||||
return *(T*)&data; // Silence compiler warning
|
||||
}
|
||||
|
||||
|
|
@ -249,10 +249,9 @@ inline const T& Value::To() const
|
|||
if(Is((byte)t))
|
||||
return GetSmallRaw<T>();
|
||||
}
|
||||
ThrowValueTypeError(String().Cat() << "Invalid value conversion: "
|
||||
<< GetName() << " -> " << typeid(T).name(),
|
||||
*this, t);
|
||||
return *(T*)&data; // Silence compiler warning
|
||||
throw ValueTypeError(String().Cat() << "Invalid value conversion: "
|
||||
<< GetName() << " -> " << typeid(T).name(),
|
||||
*this, t);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ One<Exe> Compiler::Block()
|
|||
ExeBlock& blk = result.Create<ExeBlock>();
|
||||
const char *s = p.GetSpacePtr();
|
||||
const char *b = s;
|
||||
int line = 1;
|
||||
int line = p.GetLine();
|
||||
while(*s) {
|
||||
if(*s == '$') {
|
||||
if(s[1] == '$') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue