add nil check, remove 'self' as argument, just get it through action.current()

This commit is contained in:
Tom van Dijck 2015-05-21 09:01:51 -07:00
parent 7ce257badc
commit 53e4145765
2 changed files with 13 additions and 5 deletions

View File

@ -214,7 +214,11 @@
-- True if the feature is supported, false otherwise. -- True if the feature is supported, false otherwise.
--- ---
function action.supports(self, feature) function action.supports(feature)
if not feature then
return true
end
local self = action.current()
if not self then if not self then
return false return false
end end

View File

@ -117,11 +117,15 @@
function p.project.bake(self) function p.project.bake(self)
local sln = self.solution local sln = self.solution
if not premake.action.supports(premake.action.current(), self.language) then -- check if the language for this project is supported by the action.
if not p.action.supports(self.language) then
printf(" Unsupported language '%s' used for '%s'.", self.language, self.name) printf(" Unsupported language '%s' used for '%s'.", self.language, self.name)
end end
if not premake.action.supports(premake.action.current(), self.kind) then -- check if the kind for this project is supported by the action.
if not p.action.supports(self.kind) then
printf(" Unsupported kind '%s' used for '%s'.", self.kind, self.name) printf(" Unsupported kind '%s' used for '%s'.", self.kind, self.name)
end end