public AbcTrait DefineSlot(object name, object type, bool isStatic) { if (name == null) { throw new ArgumentNullException("name"); } if (type == null) { throw new ArgumentNullException("type"); } var traitName = Abc.DefineName(name); var traits = isStatic ? Class.Traits : Traits; var trait = traits.Find(traitName, AbcTraitKind.Slot); if (trait != null) { return(trait); } var typeName = Abc.DefineTypeNameSafe(type); trait = AbcTrait.CreateSlot(typeName, traitName); traits.Add(trait); return(trait); }
private AbcMultiname BuildReturnType(object returnType, AbcMethod method) { if (returnType == null) { return(Abc.DefineTypeName(AvmTypeCode.Void)); } var generator = Abc.Generator; var source = returnType as IMethod; if (source != null) { return(generator.MethodBuilder.BuildReturnType(method, source)); } var type = returnType as IType; if (type != null) { return(generator.TypeBuilder.BuildReturnType(type)); } return(Abc.DefineTypeNameSafe(returnType)); }
public AbcTrait CreateSlot(object name, object type, bool isStatic) { if (name == null) { throw new ArgumentNullException("name"); } if (type == null) { throw new ArgumentNullException("type"); } var traitName = Abc.DefineName(name); var typeName = Abc.DefineTypeNameSafe(type); var trait = AbcTrait.CreateSlot(typeName, traitName); AddTrait(trait, isStatic); return(trait); }