public ITypeNamedCatchExceptionBlockStatement Catch(TypedName nameAndType) { var result = new TypeNamedCatchExceptionBlockStatement(this, nameAndType); this._exceptionBlocksBackup._Add(result.LocalVariable.LocalType, result); return(result); }
public ITypedLocalMember Add(TypedName nameAndType, IExpression initializationExpression) { var result = this.Add(nameAndType); result.InitializationExpression = initializationExpression; return(result); }
/// <summary> /// Creates, inserts, and returns a new <see cref="ILinqTypedJoinClause"/> which /// defines a join operation on a typed sequence given the <paramref name="leftCondition"/> /// and <paramref name="rightCondition"/> to determine an item-wise relationship /// between the two series with the results placed into the /// <paramref name="intoRangeVariableName"/> provided. /// </summary> /// <param name="rangeVariable">The <see cref="TypedName"/> which denotes /// the type and name of the range variable referenced in the expression.</param> /// <param name="rangeSelector">The <see cref="IExpression"/> which denotes where to /// find the range source.</param> /// <param name="leftCondition">The left half of the condition for the join expression, valid range variables /// at this point include those already a part of the expression.</param> /// <param name="rightCondition">The right half of the condition for the join expression, /// valid range variables at this point include those already a part of the /// expression and the <paramref name="rangeVariable"/> provided.</param> /// <param name="intoRangeVariableName">The <see cref="String"/> /// which represents the name of the range variable to place /// the join clause's results into.</param> /// <returns>An <see cref="ILinqTypedJoinClause"/> instance which defines the /// new clause.</returns> public ILinqTypedJoinClause Join(TypedName rangeVariable, IExpression rangeSelector, IExpression leftCondition, IExpression rightCondition, string intoRangeVariableName) { var result = new LinqTypedJoinClause(rangeVariable, rangeSelector, leftCondition, rightCondition, intoRangeVariableName); base.baseList.Add(result); return(result); }
/// <summary> /// Adds a new <typeparamref name="TIntermediateIndexer"/> with /// the <paramref name="nameAndReturn"/> and /// <paramref name="parameters"/> provided. /// </summary> /// <param name="nameAndReturn">The <see cref="TypedName"/> /// which specifies the indexer name and return type.</param> /// <param name="parameters">The <see cref="TypedNameSeries"/> /// which denotes the types and names of the parameters of the /// indexer to add.</param> /// <param name="canGet">Whether the property can be read.</param> /// <param name="canSet">Whether the property can be written.</param> /// <returns>A <typeparamref name="TIntermediateIndexer"/> which /// represents the indexer added.</returns> /// <exception cref="System.ArgumentException">thrown another /// member within the <see cref="IIntermediateIndexerMemberDictionary"/> /// contains the same signature.</exception> public TIntermediateIndexer Add(TypedName nameAndReturn, TypedNameSeries parameters, bool canGet = true, bool canSet = true) { var result = this.GetNew(nameAndReturn, parameters, canGet, canSet); base._Add(result.UniqueIdentifier, result); return(result); }
/// <summary> /// Creates, inserts, and returns a new <see cref="ILinqTypedFromClause"/> which /// defines the from clause by its range variable name and range source selector. /// </summary> /// <param name="rangeVariable">The <see cref="TypedName"/> which denotes /// the type and name of the range variable referenced in the expression.</param> /// <param name="rangeSelector">The <see cref="IExpression"/> which denotes where to /// find the range source.</param> /// <returns>An <see cref="ILinqTypedFromClause"/> instance which /// defines the new clause.</returns> public ILinqTypedFromClause From(TypedName rangeVariable, IExpression rangeSelector) { var result = new LinqTypedFromClause(rangeVariable, rangeSelector); base.baseList.Add(result); return(result); }
public TIntermediateParameter Add(TypedName parameterInfo) { LockCheckAndThrow(); var paramKind = IntermediateGateway.AdjustParameterType(parameterInfo, this.Parent); return(this.Add(parameterInfo.Name, paramKind, parameterInfo.Direction)); }
protected override IIntermediateTopLevelFieldMember GetField(TypedName nameAndType) { return(new IntermediateTopLevelFieldMember(nameAndType.Name, this.Parent) { FieldType = nameAndType.GetTypeRef() }); }
public TParameter AddNew(TypedName data) { TParameter result = GetParameterMember(data); this._Add(result.GetUniqueIdentifier(), result); return(result); }
protected override IIntermediateInterfacePropertyMember OnGetProperty(TypedName nameAndType) { return(new PropertyMember(nameAndType.Name, (TInstanceType)this.Parent) { PropertyType = nameAndType.GetTypeRef() }); }
public static ITryStatement TryCatch(this IBlockStatementParent parent, TypedName exceptionType) { var result = new TryStatement(parent); result.Catch(exceptionType); parent.Add(result); return(result); }
public TIntermediateField Add(TypedName nameAndType, IExpression initializationExpression) { var result = this.GetField(nameAndType); result.InitializationExpression = initializationExpression; base.AddDeclaration(result); return(result); }
public EnumerateSetBreakableBlockStatement(IBlockStatementParent parent, TypedName localNameAndType) : base(parent) { var local = this.Locals.Add(localNameAndType); local.AutoDeclare = false; this.Local = local; }
public TypeNamedCatchExceptionBlockStatement(ITryStatement parent, TypedName nameAndExceptionType) : base(parent.Parent) { this.parent = parent; this.CaughtException = nameAndExceptionType.TypeReference; this._typedLocal = this.Locals.Add(nameAndExceptionType); this._typedLocal.AutoDeclare = false; }
public IPropertyMember AddNew(TypedName nameAndType, bool hasGet, bool hasSet) { IPropertyMember result = new PropertyMember(nameAndType, this.TargetDeclaration); result.HasGet = hasGet; result.HasSet = hasSet; this._Add(result.GetUniqueIdentifier(), result); return(result); }
public IStatementBlockLocalMember AddNew(TypedName nameAndType, IExpression initializationExpression) { IStatementBlockLocalMember local = new StatementBlockLocalMember(nameAndType, this.TargetDeclaration); local.InitializationExpression = initializationExpression; local.AutoDeclare = true; this._Add(local.GetUniqueIdentifier(), local); return(local); }
/// <summary> /// Adds a new <typeparamref name="TIntermediateProperty"/> instance with /// the <paramref name="nameAndType"/>, <paramref name="canGet"/>, /// and <paramref name="canSet"/> provided. /// </summary> /// <param name="nameAndType">The name and type of the property to add.</param> /// <param name="canGet">Whether the property can be read.</param> /// <param name="canSet">Whether the property can be written.</param> /// <returns>A new <typeparamref name="TIntermediateProperty"/> instance.</returns> /// <exception cref="System.ArgumentException">The <see cref="TypedName.Name"/> on <paramref name="nameAndType"/> is null -or- /// the <see cref="TypedName.Source"/> on <paramref name="nameAndType"/> is /// <see cref="TypedNameSource.InvalidReference"/>.</exception> public TIntermediateProperty Add(TypedName nameAndType, bool canGet, bool canSet) { var result = this.GetProperty(nameAndType); result.CanRead = canGet; result.CanWrite = canSet; this.AddDeclaration(result); return(result); }
internal TIntermediateParameter _Add(TypedName parameterInfo) { var paramKind = parameterInfo.GetTypeRef(); if (paramKind.ContainsSymbols()) { paramKind = paramKind.SimpleSymbolDisambiguation(this.Parent); } return(this.AddInternal(parameterInfo.Name, paramKind, parameterInfo.Direction)); }
/// <summary> /// Adds a new <see cref="IIntermediateModuleGlobalField"/> with the /// <paramref name="nameAndType"/> and /// <paramref name="initializationExpression"/> provided. /// </summary> /// <param name="nameAndType">The <see cref="TypedName"/> /// which specifies the type of the field and its name.</param> /// <param name="initializationExpression">The <see cref="IExpression"/> /// to which the <see cref="IIntermediateModuleGlobalField"/> /// is initialized to.</param> /// <returns>A new <see cref="IIntermediateModuleGlobalField"/> /// which represents the field added.</returns> public IIntermediateModuleGlobalField Add(TypedName nameAndType, IExpression initializationExpression) { IntermediateModuleGlobalField result = new IntermediateModuleGlobalField(nameAndType.Name, base.Parent) { InitializationExpression = initializationExpression }; this.AddDeclaration(result); return(result); }
/// <summary> /// Inserts a new <see cref="IFieldMember"/> implementation into the /// <see cref="IFieldMembers"/> dictionary using the <see cref="IMember.GetUniqueIdentifier()"/> as a key. /// </summary> /// <param name="nameAndType">The name and return-type of the <see cref="IFieldMember"/>.</param> /// <returns>A new <see cref="IFieldMember"/> implementation with the <paramref name="nameAndReturn"/> provided.</returns> public IFieldMember AddNew(TypedName nameAndType, IExpression initializationExpression) { IFieldMember result = new FieldMember(nameAndType, this.TargetDeclaration); if (initializationExpression != null) { result.InitializationExpression = initializationExpression; } this._Add(result.Name, result); return(result); }
public IMethodSignatureMember AddNew(TypedName nameAndReturn, TypedName[] parameters, TypeConstrainedName[] typeParameters) { IMethodSignatureMember methodMember = new MethodSignatureMember(nameAndReturn, this.TargetDeclaration, parameters, typeParameters); if (this.ContainsKey(methodMember.GetUniqueIdentifier())) { throw new InvalidOperationException("method signature exists"); } this._Add(methodMember.GetUniqueIdentifier(), methodMember); return(methodMember); }
protected override TIntermediateIndexer GetNew(TypedName nameAndReturn, TypedNameSeries parameters, bool canGet = true, bool canSet = true) { var result = (TIntermediateIndexer)(object)this.Parent.GetNewIndexer(nameAndReturn); if (parameters.Count > 0) { result.Parameters.AddRange(parameters.ToArray()); } result.CanRead = canGet; result.CanWrite = canSet; return(result); }
public MethodSignatureMember(TypedName nameAndReturn, TParent parentTarget, TypedName[] parameters, TypeConstrainedName[] typeParameters) : base(nameAndReturn.Name, parentTarget) { this.ReturnType = nameAndReturn.TypeReference; foreach (TypeConstrainedName tcn in typeParameters) { this.TypeParameters.AddNew(tcn); } foreach (TypedName tn in parameters) { this.Parameters.AddNew(tn); } }
protected override IIntermediateInterfaceIndexerMember GetNew(TypedName nameAndReturn, TypedNameSeries parameters, bool canGet = true, bool canSet = true) { var result = new IndexerMember(nameAndReturn.Name, (TInstanceType)this.Parent); if (parameters.Count > 0) { result.Parameters.AddRange(parameters.ToArray()); } result.PropertyType = nameAndReturn.TypeReference; result.CanRead = canGet; result.CanWrite = canSet; return(result); }
private TypedName TransposeTypedName(TypedName original, TIntermediateGenericParameter target) { if (original.Source == TypedNameSource.TypeReference) { return(TransposeTypedName(new TypedName(original.Name, original.SymbolReference.GetSymbolType(), original.Direction), target)); } else if (original.Source == TypedNameSource.TypeReference) { var type = original.TypeReference; type = TransposeType(type, target); return(new TypedName(original.Name, type, original.Direction)); } return(original); }
/// <summary> /// Adds a new <typeparamref name="TIntermediateSignature"/> /// instane with the <paramref name="parameters"/>, <paramref name="typeParameters"/>, <paramref name="nameAndReturn"/> /// provided. /// </summary> /// <param name="nameAndReturn">A <see cref="TypedName"/> which designates the name of the method and its /// return-type.</param> /// <param name="parameters">The <see cref="TypedNameSeries"/> which designates /// the parameter names and types of the new <typeparamref name="TIntermediateSignature"/>.</param> /// <param name="typeParameters">An array of <see cref="GenericParameterData"/> which /// defines the type-parameters and their individual type and functional constraints.</param> /// <returns>A new <typeparamref name="TIntermediateSignature"/>.</returns> /// <exception cref="System.ArgumentException">thrown when the name portion of <paramref name="nameAndReturn"/> is <see cref="String.Empty"/> /// or an element of <paramref name="parameters"/>, or <paramref name="typeParameters"/> contains an invalid type-reference (<see cref="System.Void"/>).</exception> /// <exception cref="System.ArgumentNullException">thrown when <paramref name="typeParameters"/> /// is null.</exception> public TIntermediateSignature Add(TypedName nameAndReturn, TypedNameSeries parameters, params GenericParameterData[] typeParameters) { TIntermediateSignature method = this.Add(nameAndReturn.Name, parameters, typeParameters); var returnType = nameAndReturn.GetTypeRef(); if (returnType.ContainsSymbols()) { method.ReturnType = returnType.SimpleSymbolDisambiguation(method); } else { method.ReturnType = returnType; } return(method); }
/// <summary> /// Adds a new <typeparamref name="TIntermediateSignature"/> /// instance with the <paramref name="nameAndReturn"/> provided. /// </summary> /// <param name="nameAndReturn">A <see cref="TypedName"/> which designates the name of the method and its /// return-type.</param> /// <returns>A new <typeparamref name="TIntermediateSignature"/>.</returns> public TIntermediateSignature Add(TypedName nameAndReturn) { var method = this.GetNewMethod(nameAndReturn.Name); var returnType = nameAndReturn.GetTypeRef(); if (returnType.ContainsSymbols()) { method.ReturnType = returnType.SimpleSymbolDisambiguation(method); } else { method.ReturnType = returnType; } this.AddDeclaration(method); return(method); }
public IIndexerMember AddNew(TypedName nameAndType, bool hasGet, bool hasSet, TypedName[] parameters) { if (parameters == null || parameters.Length <= 0) { throw new ArgumentException("Indexers must have at least one parameter."); } IIndexerMember result = new IndexerMember(nameAndType.Name, nameAndType.TypeReference, this.TargetDeclaration); foreach (TypedName tn in parameters) { result.Parameters.AddNew(tn); } result.HasGet = hasGet; result.HasSet = hasSet; this._Add(result.GetUniqueIdentifier(), result); return(result); }
protected override IIntermediateInterfaceEventMember GetEvent(TypedName typedName) { if ((typedName.Source == TypedNameSource.TypeReference && typedName.TypeReference is IDelegateType) || typedName.Source == TypedNameSource.SymbolReference) { return new EventMember(this.Parent) { Name = typedName.Name, SignatureType = (IDelegateType)typedName.TypeReference } } ; else { throw new ArgumentException("typedName"); } }
private void SetRangeVariableType(TypedName rangeVariable) { switch (rangeVariable.Source) { case TypedNameSource.TypeReference: this.rangeType = rangeVariable.TypeReference; break; case TypedNameSource.SymbolReference: this.rangeType = rangeVariable.SymbolReference.GetSymbolType(); break; case TypedNameSource.InvalidReference: throw new ArgumentOutOfRangeException("rangeVariable"); default: break; } }
/// <summary> /// Creates a new <see cref="LinqTypedFromClause"/> which has /// an explicit type referenced to its <paramref name="rangeVariable"/>. /// </summary> /// <param name="rangeVariable">The <see cref="TypedName"/> denoting the name /// and type of the range variable for the from clause.</param> /// <param name="rangeSource">The <see cref="IExpression"/> which /// denotes where to obtain </param> public LinqTypedFromClause(TypedName rangeVariable, IExpression rangeSource) : base(rangeVariable.Name, rangeSource) { switch (rangeVariable.Source) { case TypedNameSource.TypeReference: this.rangeType = rangeVariable.TypeReference; break; case TypedNameSource.SymbolReference: this.rangeType = rangeVariable.SymbolReference.GetSymbolType(); break; case TypedNameSource.InvalidReference: throw new ArgumentOutOfRangeException("rangeVariable"); default: break; } }