public FormalTypeParam(Position position, Name name, object defaultType, List<CustomAttribute> attributes) : base(position) { this.name = name; this.defaultType = defaultType; this.attributes = new CustomAttributes(attributes); }
public FormalTypeParam(Text.Span span, Name name, object defaultType, List<CustomAttribute> attributes) : base(span) { Debug.Assert(defaultType == null || defaultType is PrimitiveTypeName || defaultType is GenericQualifiedName); this.name = name; this.defaultType = defaultType; if (attributes != null && attributes.Count != 0) this.Attributes = new CustomAttributes(attributes); }
internal static void Merge(AstNode node, CustomAttributes otherattributes) { if (otherattributes != null) { var attributes = node.GetCustomAttributes(); if (attributes == null) node.SetCustomAttributes(attributes = new CustomAttributes(null)); attributes.Merge(otherattributes); } }
internal void Merge(CustomAttributes other) { if (other.attributes == null) return; if (attributes == null) { attributes = other.attributes; return; } attributes.AddRange(other.attributes); other.attributes = null; }
internal void Merge(CustomAttributes other) { if (other == null || other.attributes == null) return; if (attributes == null || attributes.Count == 0) { attributes = other.attributes; } else { attributes.AddRange(other.attributes); } other.attributes = null; }
protected TypeMemberDecl(Position position, List<CustomAttribute> attributes) : base(position) { if (attributes != null && attributes.Count != 0) this.Attributes = new CustomAttributes(attributes); }
public GlobalConstDeclList(Position position, List<GlobalConstantDecl>/*!*/ constants, List<CustomAttribute> attributes, string docComment) : base(position) { Debug.Assert(constants != null); this.constants = constants; this.docComment = docComment; this.attributes = new CustomAttributes(attributes); }
public static void SetCustomAttributes(this IPropertyCollection/*!*/properties, CustomAttributes attributes) { if (attributes != null) properties[typeof(CustomAttributes)] = attributes; else properties.RemoveProperty(typeof(CustomAttributes)); }
public FunctionDecl(SourceUnit/*!*/ sourceUnit, Position position, Position entireDeclarationPosition, ShortPosition headingEndPosition, ShortPosition declarationBodyPosition, bool isConditional, Scope scope, PhpMemberAttributes memberAttributes, string/*!*/ name, NamespaceDecl ns, bool aliasReturn, List<FormalParam>/*!*/ formalParams, List<FormalTypeParam>/*!*/ genericParams, List<Statement>/*!*/ body, List<CustomAttribute> attributes) : base(position) { Debug.Assert(genericParams != null && name != null && formalParams != null && body != null); this.name = new Name(name); this.ns = ns; this.signature = new Signature(aliasReturn, formalParams); this.typeSignature = new TypeSignature(genericParams); this.attributes = new CustomAttributes(attributes); this.body = body; this.entireDeclarationPosition = entireDeclarationPosition; this.headingEndPosition = headingEndPosition; this.declarationBodyPosition = declarationBodyPosition; QualifiedName qn = (ns != null) ? new QualifiedName(this.name, ns.QualifiedName) : new QualifiedName(this.name); function = new PhpFunction(qn, memberAttributes, signature, typeSignature, isConditional, scope, sourceUnit, position); function.WriteUp(typeSignature.ToPhpRoutineSignature(function)); function.Declaration.Node = this; }
public FormalParam(Position position, string/*!*/ name, object typeHint, bool passedByRef, Expression initValue, List<CustomAttribute> attributes) : base(position) { this.name = new VariableName(name); this.typeHint = typeHint; this.passedByRef = passedByRef; this.initValue = initValue; this.attributes = new CustomAttributes(attributes); this.resolvedTypeHint = null; }
public TypeDecl(SourceUnit/*!*/ sourceUnit, Position position, Position entireDeclarationPosition, ShortPosition headingEndPosition, ShortPosition declarationBodyPosition, bool isConditional, Scope scope, PhpMemberAttributes memberAttributes, bool isPartial, Name className, Position classNamePosition, NamespaceDecl ns, List<FormalTypeParam>/*!*/ genericParams, Tuple<GenericQualifiedName, Position> baseClassName, List<KeyValuePair<GenericQualifiedName, Position>>/*!*/ implementsList, List<TypeMemberDecl>/*!*/ members, List<CustomAttribute> attributes) : base(position) { Debug.Assert(genericParams != null && implementsList != null && members != null); Debug.Assert((memberAttributes & PhpMemberAttributes.Trait) == 0 || (memberAttributes & PhpMemberAttributes.Interface) == 0, "Interface cannot be a trait"); this.name = className; this.NamePosition = classNamePosition; this.ns = ns; this.typeSignature = new TypeSignature(genericParams); if (baseClassName != null) { this.baseClassName = baseClassName.Item1; this.BaseClassNamePosition = baseClassName.Item2; } this.implementsList = implementsList; this.members = members; this.attributes = new CustomAttributes(attributes); this.entireDeclarationPosition = entireDeclarationPosition; this.headingEndPosition = headingEndPosition; this.declarationBodyPosition = declarationBodyPosition; this.partialKeyword = isPartial; // remember current aliases: var aliases = (ns != null) ? ns.Aliases : sourceUnit.Aliases; if (aliases.Count > 0) validAliases = new Dictionary<string, QualifiedName>(aliases); // create stuff necessary for inclusion resolving process, other structures are created duirng analysis: QualifiedName qn = (ns != null) ? new QualifiedName(name, ns.QualifiedName) : new QualifiedName(name); type = new PhpType(qn, memberAttributes, isPartial, typeSignature, isConditional, scope, sourceUnit, position); //// add alias for private classes (if not added yet by partial declaration): //if (type.IsPrivate) // sourceUnit.AddTypeAlias(qn, this.name); // member-analysis needs the node: type.Declaration.Node = this; }
public FormalParam(Text.Span span, string/*!*/ name, object typeHint, Flags flags, Expression initValue, List<CustomAttribute> attributes) : base(span) { Debug.Assert(typeHint == null || typeHint is PrimitiveTypeName || typeHint is GenericQualifiedName); this.name = new VariableName(name); this.typeHint = typeHint; this._flags = flags; this.initValue = initValue; if (attributes != null && attributes.Count != 0) this.Attributes = new CustomAttributes(attributes); this.TypeHintPosition = Text.Span.Invalid; }
protected TypeMemberDecl(Position position, List<CustomAttribute> attributes) : base(position) { this.attributes = new CustomAttributes(attributes); }
protected TypeMemberDecl(Text.Span span, List<CustomAttribute> attributes) : base(span) { if (attributes != null && attributes.Count != 0) this.Attributes = new CustomAttributes(attributes); }
public static void SetCustomAttributes(this IPropertyCollection /*!*/ properties, CustomAttributes attributes) { if (attributes != null) { properties[typeof(CustomAttributes)] = attributes; } else { properties.RemoveProperty(typeof(CustomAttributes)); } }
public void Emit(CustomAttributes/*!*/node, CodeGenerator/*!*/ codeGenerator, IPhpCustomAttributeProvider/*!*/ target) { if (node.Attributes == null) return; foreach (CustomAttribute attribute in node.Attributes) attribute.Emit(codeGenerator, target); }
public int Count(CustomAttributes/*!*/node, DType/*!*/ attributeType, CustomAttribute.TargetSelectors selector) { if (node.Attributes == null) return 0; int count = 0; foreach (CustomAttribute attribute in node.Attributes) { if (attribute.TargetSelector == selector && attribute.GetResolvedType().Equals(attributeType)) count++; } return count; }
public void Analyze(CustomAttributes/*!*/node, Analyzer/*!*/ analyzer, IPhpCustomAttributeProvider/*!*/ target) { if (node.Attributes == null) return; bool duplicate_found = false; foreach (CustomAttribute attribute in node.Attributes) attribute.Analyze(analyzer, target, ref duplicate_found); }
public void AnalyzeMembers(CustomAttributes/*!*/node, Analyzer/*!*/ analyzer, Scope referringScope) { if (node.Attributes == null) return; foreach (CustomAttribute attribute in node.Attributes) attribute.AnalyzeMembers(analyzer, referringScope); }