我有这样的代码块,我试图摆脱 Float 应该是 Int 和 Missing Return 错误。
package com.bykd.dev;
@:final class Version
{
public static inline var SPLIT_CHAR : String = ".";
public static var revisionKeyword : String = "Revision";
private var _tag : String;
private var _numbers : Array<Dynamic>;
public static function create(pfx : String, rev : String = null, sfx : String = null) : Version
{
var nums : Array<Dynamic> = null;
nums = pfx.split(SPLIT_CHAR);
if (rev != null)
{
nums.push(trimRevision(rev));
}
return new Version(nums, sfx);
private static function trimRevision(rev : String) : String
{
var beg : Float = Math.NaN;
var end : Float = Math.NaN;
beg = Std.string("$" + revisionKeyword + ": ").length;
end = rev.lastIndexOf(" $");
return rev.substring(beg, end);
}
}
错误在最后几行:
end = rev.lastIndexOf(" $");
return rev.substring(beg, end);
任何帮助将不胜感激。