@@ -113,33 +113,33 @@ SlangResult IncludeSystem::findFile(String const& pathToInclude, String const& p
113
113
return SLANG_E_NOT_FOUND;
114
114
}
115
115
116
- SlangResult IncludeSystem::loadFile (const PathInfo& pathInfo, ComPtr<ISlangBlob>& outBlob)
116
+ SlangResult IncludeSystem::loadFile (const PathInfo& pathInfo, ComPtr<ISlangBlob>& outBlob, SourceFile*& outSourceFile )
117
117
{
118
118
if (m_sourceManager)
119
119
{
120
120
// See if this an already loaded source file
121
- SourceFile* sourceFile = m_sourceManager->findSourceFileRecursively (pathInfo.uniqueIdentity );
121
+ outSourceFile = m_sourceManager->findSourceFileRecursively (pathInfo.uniqueIdentity );
122
122
123
123
// If not create a new one, and add to the list of known source files
124
- if (!sourceFile )
124
+ if (!outSourceFile )
125
125
{
126
126
ComPtr<ISlangBlob> foundSourceBlob;
127
127
if (SLANG_FAILED (m_fileSystemExt->loadFile (pathInfo.foundPath .getBuffer (), foundSourceBlob.writeRef ())))
128
128
{
129
129
return SLANG_E_CANNOT_OPEN;
130
130
}
131
131
132
- sourceFile = m_sourceManager->createSourceFileWithBlob (pathInfo, foundSourceBlob);
133
- m_sourceManager->addSourceFile (pathInfo.uniqueIdentity , sourceFile );
132
+ outSourceFile = m_sourceManager->createSourceFileWithBlob (pathInfo, foundSourceBlob);
133
+ m_sourceManager->addSourceFile (pathInfo.uniqueIdentity , outSourceFile );
134
134
135
135
outBlob = foundSourceBlob;
136
136
return SLANG_OK;
137
137
}
138
138
else
139
139
{
140
- if (sourceFile ->getContentBlob ())
140
+ if (outSourceFile ->getContentBlob ())
141
141
{
142
- outBlob = sourceFile ->getContentBlob ();
142
+ outBlob = outSourceFile ->getContentBlob ();
143
143
return SLANG_OK;
144
144
}
145
145
@@ -149,7 +149,7 @@ SlangResult IncludeSystem::loadFile(const PathInfo& pathInfo, ComPtr<ISlangBlob>
149
149
return SLANG_E_CANNOT_OPEN;
150
150
}
151
151
152
- sourceFile ->setContents (foundSourceBlob);
152
+ outSourceFile ->setContents (foundSourceBlob);
153
153
154
154
outBlob = foundSourceBlob;
155
155
return SLANG_OK;
@@ -158,6 +158,7 @@ SlangResult IncludeSystem::loadFile(const PathInfo& pathInfo, ComPtr<ISlangBlob>
158
158
else
159
159
{
160
160
// If we don't have the source manager, just load
161
+ outSourceFile = nullptr ;
161
162
return m_fileSystemExt->loadFile (pathInfo.foundPath .getBuffer (), outBlob.writeRef ());
162
163
}
163
164
}
0 commit comments