void DefinePrototype(AvmTypeCode type, AbcMethod sig) { var srcmethod = sig.Method; if (srcmethod == null) { return; } string key = GetKey(type, srcmethod.Name); var val = _prototypes[key] as object[]; if (val == null) { return; } var m = val[1] as AbcMethod; if (m != null) { return; } var coder = val[0] as AbcCoder; m = Abc.DefineMethod(Sig.@from(sig), coder); _generator.NewApi.SetProtoFunction(type, sig.TraitName, m); val[0] = m; }
private static void TestBuiltinType(AbcFile abc, AvmTypeCode type) { var name = abc.BuiltinTypes[type]; var mn = abc.ImportConst(name); Assert.IsTrue(ReferenceEquals(name, mn)); }
public AbcMultiname this[AvmTypeCode code] { get { int i = (int)code; return(_types[i] ?? (_types[i] = _abc.DefineName(Names[i]))); } }
public static bool Is(this IType type, AvmTypeCode typeCode) { if (type == null) { return(false); } var instance = type.AbcInstance(); if (instance == null) { return(false); } if (!instance.IsNative) { return(false); } return(instance.FullName == typeCode.FullName()); }
void RegisterPrototype(AvmTypeCode type, string name, AbcCoder coder) { string key = GetKey(type, name); _prototypes[key] = new object[] { coder, null }; }
static string GetKey(AvmTypeCode type, string name) { return((int)type + "." + name); }
public static string FullName(this AvmTypeCode typeCode) { return(BuiltinTypes.GetFullName(typeCode)); }
public static string GetFullName(AvmTypeCode typeCode) { int i = (int)typeCode; return(Names[i].FullName); }