aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerStack.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-02-21 01:15:34 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-02-21 23:03:44 +0800
commit7b709c7c8ad1553feabd294f83e3b7ce2281114a (patch)
tree63d0ac75e9f3e0f8ad138ff0584851141f2ea0d2 /CompilerStack.cpp
parent75498a48d83277240605b43e27197be36c02ce23 (diff)
downloaddexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.tar
dexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.tar.gz
dexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.tar.bz2
dexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.tar.lz
dexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.tar.xz
dexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.tar.zst
dexon-solidity-7b709c7c8ad1553feabd294f83e3b7ce2281114a.zip
Adding Libraries as source units
Diffstat (limited to 'CompilerStack.cpp')
-rw-r--r--CompilerStack.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp
index ca9c75bc..a5cd9198 100644
--- a/CompilerStack.cpp
+++ b/CompilerStack.cpp
@@ -58,14 +58,15 @@ CompilerStack::CompilerStack(bool _addStandardSources):
m_addStandardSources(_addStandardSources), m_parseSuccessful(false)
{
if (m_addStandardSources)
- addSources(StandardSources);
+ addSources(StandardSources, true); // add them as libraries
}
-bool CompilerStack::addSource(string const& _name, string const& _content)
+bool CompilerStack::addSource(string const& _name, string const& _content, bool _isLibrary)
{
bool existed = m_sources.count(_name) != 0;
reset(true);
m_sources[_name].scanner = make_shared<Scanner>(CharStream(expanded(_content)), _name);
+ m_sources[_name].isLibrary = _isLibrary;
return existed;
}
@@ -328,7 +329,8 @@ void CompilerStack::resolveImports()
};
for (auto const& sourcePair: m_sources)
- toposort(&sourcePair.second);
+ if (!sourcePair.second.isLibrary)
+ toposort(&sourcePair.second);
swap(m_sourceOrder, sourceOrder);
}