public DefaultParameter(IParameter p) { this.name = p.Name; this.region = p.Region; this.modifier = p.Modifiers; this.returnType = p.ReturnType; }
/// <summary> /// prepare the method declaration for another parameter; /// this is useful for writing method declarations /// </summary> /// <param name="MethodDeclaration"></param> /// <param name="firstParameter"></param> /// <param name="align"></param> /// <param name="AParamName"></param> /// <param name="AParamModifier"></param> /// <param name="AParamTypeName"></param> public static void AddParameter(ref string MethodDeclaration, ref bool firstParameter, int align, string AParamName, ParameterModifiers AParamModifier, string AParamTypeName) { if (!firstParameter) { MethodDeclaration += "," + Environment.NewLine; MethodDeclaration += new String(' ', align); } firstParameter = false; String parameterType = AParamTypeName; String StrParameter = ""; if ((ParameterModifiers.Ref & AParamModifier) > 0) { StrParameter += "ref "; } else if ((ParameterModifiers.Out & AParamModifier) > 0) { StrParameter += "out "; } StrParameter += parameterType + " " + AParamName; MethodDeclaration += StrParameter; }
/// <summary> /// Initializes a new instance of the Argument class. /// </summary> /// <param name="name">The optional name of the argument.</param> /// <param name="modifiers">Modifers applied to this argument.</param> /// <param name="argumentExpression">The expression that forms the body of the argument.</param> /// <param name="location">The location of the argument in the code.</param> /// <param name="parent">The parent code part.</param> /// <param name="tokens">The tokens that form the argument.</param> /// <param name="generated">Indicates whether the argument is located within a block of generated code.</param> internal Argument( CsToken name, ParameterModifiers modifiers, Expression argumentExpression, CodeLocation location, Reference<ICodePart> parent, CsTokenList tokens, bool generated) { Param.Ignore(name); Param.Ignore(modifiers); Param.AssertNotNull(argumentExpression, "argumentExpression"); Param.AssertNotNull(location, "location"); Param.AssertNotNull(parent, "parent"); Param.Ignore(tokens); Param.Ignore(generated); this.name = name; this.modifiers = modifiers; this.argumentExpression = argumentExpression; this.location = location; this.parent = parent; this.tokens = tokens; this.generated = generated; }
/// <summary> /// Initializes a new instance of the GenericTypeParameter class. /// </summary> /// <param name="type">The generic type parameter.</param> /// <param name="modifiers">Optional modifiers.</param> internal GenericTypeParameter(TypeToken type, ParameterModifiers modifiers) { Param.AssertNotNull(type, "type"); Param.Ignore(modifiers); this.type = type; this.modifiers = modifiers; }
public void Add(ParameterModifiers m) { if ((cur & m) == 0) { cur |= m; } else { parser.Error("param modifier " + m + " already defined"); } }
internal Parameter(TypeToken type, string name, ParameterModifiers modifiers, CodeLocation location, CsTokenList tokens, bool generated) { this.type = type; this.name = name; this.modifiers = modifiers; this.location = location; this.tokens = tokens; this.generated = generated; }
/// <summary> /// Initializes a new instance of the Argument class. /// </summary> /// <param name="proxy">The proxy class.</param> /// <param name="modifiers">The parameter modifiers.</param> /// <param name="argumentExpression">The argument expression.</param> internal Argument(CodeUnitProxy proxy, ParameterModifiers modifiers, Expression argumentExpression) : base(proxy, CodeUnitType.Argument) { Param.AssertNotNull(proxy, "proxy"); Param.Ignore(modifiers, "modifiers"); Param.AssertNotNull(argumentExpression, "argumentExpression"); this.modifiers.Value = modifiers; this.argumentExpression.Value = argumentExpression; }
public ParameterDeclaration(string name, TypeReference type, ParameterModifiers modifiers) { this.Name = name; this.Type = type; this.Modifiers = modifiers; }
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) { }
protected string GetString (ParameterModifiers m) { string res; if (cachedParameterModifiers.TryGetValue (m, out res)) return res; StringBuilder result = new StringBuilder (); foreach (ParameterModifiers singleModifier in Enum.GetValues (typeof(ParameterModifiers))) { if ((m & singleModifier) == singleModifier && parameterModifiers.ContainsKey (singleModifier)) { if (result.Length > 0) result.Append (' '); result.Append (parameterModifiers[singleModifier]); } } return cachedParameterModifiers [m] = result.ToString (); }
public ParamModifierList(Parser parser) { this.parser = parser; cur = ParameterModifiers.None; }
public void CalculateChangeHandlesAllPossibleValues(ParameterModifiers oldValue, ParameterModifiers newValue) { var sut = new ParameterModifiersChangeTable(); Action action = () => sut.CalculateChange(oldValue, newValue); action.Should().NotThrow(); }
public FormalParameter(string typeName, string parameterName, ParameterModifiers modifiers, FileSpan location) : this(typeName, parameterName) { this.Modifiers = modifiers; this.Location = location; }
public ParamModifierList(Parser parser) { this.parser = parser; cur = ParameterModifiers.None; }
public bool ShouldSerialize(ParameterModifiers value) { return (long)value != 0; }
public bool ShouldSerialize(ParameterModifiers value) { return value != ParameterModifiers.None; }
public ParameterDeclaration(string name, TypeReference type, ParameterModifiers modifiers) { this.Name = name; this.Type = type; this.Modifiers = modifiers; }
public ParamModifierList(Parser parser) { _parser = parser; _cur = ParameterModifiers.None; }
/// <summary> /// The save. /// </summary> /// <param name="parameterModifiers"> /// The parameter modifiers. /// </param> /// <param name="indentedTextWriter"> /// The indented text writer. /// </param> private void Save(ParameterModifiers parameterModifiers, IndentedTextWriter indentedTextWriter) { var parameterModifiersString = string.Empty; switch (parameterModifiers) { case ParameterModifiers.Out: // parameterModifiersString = "out "; break; case ParameterModifiers.Params: parameterModifiersString = "/*params*/ "; break; case ParameterModifiers.Ref: // parameterModifiersString = "ref "; break; case ParameterModifiers.This: parameterModifiersString = "this "; break; case ParameterModifiers.None: default: return; } indentedTextWriter.Write(parameterModifiersString); }
public ParameterDeclaration(string name, TypeReference type, ParameterModifiers modifiers) : base(name, type, modifiers) { }
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) { TypeReference = typeReference; ParameterName = parameterName; ParamModifier = paramModifier; DefaultValue = defaultValue; attributes = new List<AttributeSection>(); }
/// <summary> /// Initializes a new instance of the Parameter class. /// </summary> /// <param name="type"> /// The type of the parameter. /// </param> /// <param name="name"> /// The name of the parameter. /// </param> /// <param name="parent"> /// The parent of the parameter. /// </param> /// <param name="modifiers"> /// Modifiers applied to this parameter. /// </param> /// <param name="defaultArgument"> /// The optional default argument for the parameter. /// </param> /// <param name="location"> /// The location of the parameter in the code. /// </param> /// <param name="tokens"> /// The tokens that form the parameter. /// </param> /// <param name="generated"> /// Indicates whether the parameter is located within a block of generated code. /// </param> internal Parameter( TypeToken type, string name, Reference<ICodePart> parent, ParameterModifiers modifiers, Expression defaultArgument, CodeLocation location, CsTokenList tokens, bool generated) { Param.Ignore(type); Param.AssertValidString(name, "name"); Param.AssertNotNull(parent, "parent"); Param.Ignore(modifiers); Param.Ignore(defaultArgument); Param.AssertNotNull(location, "location"); Param.Ignore(tokens); Param.Ignore(generated); this.type = type; this.name = CodeLexer.DecodeEscapedText(name, true); this.parent = parent; this.modifiers = modifiers; this.defaultArgument = defaultArgument; this.location = location; this.tokens = tokens; this.generated = generated; }
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) { }
public Expression Serialize(ParameterModifiers value) { return SerializeEnum("ParameterModifiers", (long)value); }
/// <summary> /// The save modifiers after. /// </summary> /// <param name="parameterModifiers"> /// The parameter modifiers. /// </param> /// <param name="indentedTextWriter"> /// The indented text writer. /// </param> private void SaveModifiersAfter(ParameterModifiers parameterModifiers, IndentedTextWriter indentedTextWriter) { var parameterModifiersString = string.Empty; switch (parameterModifiers) { case ParameterModifiers.Out: parameterModifiersString = "&"; break; case ParameterModifiers.Params: break; case ParameterModifiers.Ref: parameterModifiersString = "&"; break; case ParameterModifiers.This: break; case ParameterModifiers.None: default: return; } indentedTextWriter.Write(parameterModifiersString); }