/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="type">The attribute type.</param> /// <param name="attribute">The CCI attribute.</param> internal ScriptAttribute(ICustomAttribute attribute) { if (attribute == null) throw new InvalidOperationException(); var typeRef = attribute.Type as INamedTypeReference; if (typeRef == null) { throw new InvalidOperationException("Attribute type must be a named type."); } var type = ScriptDomain.CurrentDomain.ResolveType(typeRef); if (type == null) { throw new InvalidOperationException("Unable to resolve type for attribute: " + typeRef.Name); } _type = type; _cciAttribute = attribute; _arguments = _cciAttribute.Arguments .Select(a => GetConstantValue(a)).ToArray(); _namedArgs = _cciAttribute.NamedArguments.ToDictionary(a => a.ArgumentName.Value, a => GetConstantValue(a)); }
/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="container">The containing type.</param> /// <param name="memberDef">The CCI member definition.</param> internal ScriptMember(ScriptType container, ITypeDefinitionMember memberDef) { if (container == null || memberDef == null) throw new InvalidOperationException(); _container = container; _cciMember = memberDef; }
// get the unique ID for a type private static string GetKey(ScriptType type) { if (type == null) return null; return type._container.Id + "/" + type.Name; }
/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="container">The containing type.</param> /// <param name="fieldDef">The CCI field definition.</param> internal ScriptField(ScriptType container, IFieldDefinition fieldDef) : base(container, fieldDef) { _cciField = fieldDef; }
/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="container">The containing type.</param> /// <param name="methodDef">The CCI method definition.</param> internal ScriptMethod(ScriptType container, IMethodDefinition methodDef) : base(container, methodDef) { _cciMethod = methodDef; }
/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="container">The containing type.</param> /// <param name="propDef">The CCI property definition.</param> internal ScriptProperty(ScriptType container, IPropertyDefinition propDef) : base(container, propDef) { _cciProperty = propDef; }
/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="container">The containing type.</param> /// <param name="propDef">The CCI property definition.</param> internal ScriptProperty(ScriptType container, IPropertyDefinition propDef) : base(container, propDef) { _cciProperty = propDef; }