Skip to content

Commit

Permalink
Final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 committed Aug 28, 2024
1 parent 5302095 commit f1cf81d
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lua/starfall/preprocessor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@ SF.Preprocessor = {
mainfile = ""
}, t)

for path, code in pairs(files) do
local fdata = SF.PreprocessData(path, code)
fdata:Preprocess()
self.files[path] = fdata
end
for path, fdata in pairs(self.files) do
fdata:Postprocess(self)
if files then
for path, code in pairs(files) do
local fdata = SF.PreprocessData(path, code)
fdata:Preprocess()
self.files[path] = fdata
end
for path, fdata in pairs(self.files) do
fdata:Postprocess(self)
end
end

return self
Expand All @@ -193,7 +195,7 @@ SF.FileLoader = {
self.files[path] = fdata
end,

LoadUrl = function(self, name, url)
LoadUrl = function(self, url, name)
if self.files[name] then return end

local cache = self.httpCache[url]
Expand All @@ -219,7 +221,7 @@ SF.FileLoader = {
failed = function(reason)
if self.errored then return end
self.errored=true
self.onfail(string.format("Could not fetch --@include link (%s): %s", reason, url))
self.onfail(string.format("Could not fetch --@include link (%s): %s", url, reason))
end,
}
end,
Expand Down Expand Up @@ -272,8 +274,10 @@ SF.FileLoader = {

local ok, err = pcall(function()
local files = {}
local postprocessor = SF.Preprocessor()
postprocessor.files = self.files
for path, fdata in pairs(self.files) do
fdata:Postprocess(self)
fdata:Postprocess(postprocessor)
files[path] = fdata.code
end
self.onsuccess(files, self.mainfile)
Expand Down

0 comments on commit f1cf81d

Please sign in to comment.