blob: dbcc0f8517a6a4c0d2a7db1275d950bbeb9dd306 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// PR c++/39367
// { dg-options "-O" }
class QScriptEnginePrivate;
class QScriptClassInfo;
namespace QScript {
enum Type { InvalidType };
};
class QScriptValueImpl {
public:
inline QScriptValueImpl();
QScript::Type m_type;
};
namespace QScript {
namespace Ecma {
class Core {
public:
inline QScriptEnginePrivate *engine() const { }
inline QScriptClassInfo *classInfo() const { }
QScriptValueImpl publicPrototype;
};
class Boolean: public Core {
void newBoolean(QScriptValueImpl *result, bool value = false);
};
}
template <typename T> class Buffer {
public:
inline void reserve(int num);
inline void resize(int s);
T *m_data;
int m_capacity;
int m_size;
};
}
template <typename T> void QScript::Buffer<T>::resize(int s) {
if (m_capacity < s)
reserve (s << 1);
}
template <typename T> void QScript::Buffer<T>::reserve(int x) {
T *new_data = new T[m_capacity];
for (int i=0; i<m_size; ++i)
new_data[i] = m_data[i];
}
class QScriptObject {
public:
inline void reset();
QScript::Buffer<QScriptValueImpl> m_values;
};
class QScriptEnginePrivate {
public:
inline QScriptObject *allocObject() { return 0; }
inline void newObject(QScriptValueImpl *o, const QScriptValueImpl &proto,
QScriptClassInfo *oc = 0);
};
inline void QScriptEnginePrivate::newObject(QScriptValueImpl *o,
const QScriptValueImpl &proto,
QScriptClassInfo *oc)
{
QScriptObject *od = allocObject();
od->reset();
}
inline QScriptValueImpl::QScriptValueImpl() : m_type(QScript::InvalidType) { }
inline void QScriptObject::reset() { m_values.resize(0); }
namespace QScript {
namespace Ecma {
void Boolean::newBoolean(QScriptValueImpl *result, bool value)
{
engine()->newObject(result, publicPrototype, classInfo());
}
}
}
|