Simplify AssetsMacro.embedData().
This commit is contained in:
@@ -91,24 +91,22 @@ class AssetsMacro
|
|||||||
if (Context.defined("display")) return null;
|
if (Context.defined("display")) return null;
|
||||||
|
|
||||||
var classType = Context.getLocalClass().get();
|
var classType = Context.getLocalClass().get();
|
||||||
var metaData = classType.meta.get();
|
var metaData = classType.meta;
|
||||||
var position = Context.currentPos();
|
var position = Context.currentPos();
|
||||||
var fields = Context.getBuildFields();
|
var fields = Context.getBuildFields();
|
||||||
|
|
||||||
for (meta in metaData)
|
for (meta in metaData.extract(metaName))
|
||||||
{
|
|
||||||
if (meta.name == metaName)
|
|
||||||
{
|
|
||||||
if (meta.params.length > 0)
|
|
||||||
{
|
{
|
||||||
|
if (meta.params.length == 0) continue;
|
||||||
|
|
||||||
switch (meta.params[0].expr)
|
switch (meta.params[0].expr)
|
||||||
{
|
{
|
||||||
|
case EConst(CString("" | null)):
|
||||||
|
return null;
|
||||||
|
|
||||||
case EConst(CString(filePath)):
|
case EConst(CString(filePath)):
|
||||||
var path = filePath;
|
var path = filePath;
|
||||||
|
|
||||||
if (path == "") return null;
|
|
||||||
if (path == null) return null;
|
|
||||||
|
|
||||||
if (!FileSystem.exists(filePath))
|
if (!FileSystem.exists(filePath))
|
||||||
{
|
{
|
||||||
path = Context.resolvePath(filePath);
|
path = Context.resolvePath(filePath);
|
||||||
@@ -171,8 +169,6 @@ class AssetsMacro
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user