aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/value.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-03-26 16:20:32 +0100
committerChristian Kandeler <christian.kandeler@digia.com>2014-03-26 17:34:16 +0100
commit37a9936b1d9f2e7800249c47a044ccd7d7d3c26a (patch)
treebfc721389e596d2364907d354348699fd224d806 /src/lib/corelib/language/value.cpp
parent8042731153f49484dc831b7e51675652cef317cb (diff)
Do not store CodeLocations in JSSourceValue objects.
The information is partly redundant, as we already know the file path. Set only line and column info instead. This lowers peak memory use by ~2% with little effort. Change-Id: I7c8b34aa9a026a6e8cf3d06e5caef5ceeae11270 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/corelib/language/value.cpp')
-rw-r--r--src/lib/corelib/language/value.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/corelib/language/value.cpp b/src/lib/corelib/language/value.cpp
index 806905d5c..f39b1bc0c 100644
--- a/src/lib/corelib/language/value.cpp
+++ b/src/lib/corelib/language/value.cpp
@@ -44,7 +44,7 @@ Value::~Value()
JSSourceValue::JSSourceValue()
- : Value(JSSourceValueType)
+ : Value(JSSourceValueType), m_line(-1), m_column(-1)
{
}
@@ -68,6 +68,17 @@ QString JSSourceValue::sourceCodeForEvaluation() const
return prefix + m_sourceCode.toString() + suffix;
}
+void JSSourceValue::setLocation(int line, int column)
+{
+ m_line = line;
+ m_column = column;
+}
+
+CodeLocation JSSourceValue::location() const
+{
+ return CodeLocation(m_file->filePath(), m_line, m_column);
+}
+
void JSSourceValue::setHasFunctionForm(bool b)
{
if (b)