コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the SimplePreprocessorDirective class.
        /// </summary>
        /// <param name="document">The parent document.</param>
        /// <param name="text">The preprocessor directive text.</param>
        /// <param name="preprocessorDirectiveType">The preprocessor directive type.</param>
        /// <param name="location">The location of the directive within the code document.</param>
        /// <param name="generated">True if the directive is inside of a block of generated code.</param>
        internal SimplePreprocessorDirective(CsDocument document, string text, PreprocessorType preprocessorDirectiveType, CodeLocation location, bool generated)
            : base(new CodeUnitProxy(document), preprocessorDirectiveType, location)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertValidString(text, "text");
            Param.Ignore(preprocessorDirectiveType);
            Param.AssertNotNull(location, "location");
            Param.Ignore(generated);

            this.Text      = text;
            this.Generated = generated;
        }
コード例 #2
0
ファイル: DefineDirective.cs プロジェクト: sarvex/StyleCop
 /// <summary>
 /// Initializes a new instance of the DefineDirective class.
 /// </summary>
 /// <param name="document">The parent document.</param>
 /// <param name="text">The text within the directive.</param>
 /// <param name="location">The location of the preprocessor directive in the code.</param>
 /// <param name="generated">Indicates whether the item is generated.</param>
 internal DefineDirective(CsDocument document, string text, CodeLocation location, bool generated)
     : base(document, text, PreprocessorType.Define, location, generated)
 {
     Param.AssertNotNull(document, "document");
     Param.Ignore(text, location, generated);
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the OperatorSymbolToken class.
        /// </summary>
        /// <param name="document">The parent document.</param>
        /// <param name="text">The text of the operator symbol.</param>
        /// <param name="category">The category of the operator.</param>
        /// <param name="symbolType">The specific symbol type.</param>
        /// <param name="location">The location of the operator symbol in the code document.</param>
        /// <param name="generated">Indicates whether the operator lies within a block of generated code.</param>
        internal OperatorSymbolToken(CsDocument document, string text, OperatorCategory category, OperatorType symbolType, CodeLocation location, bool generated)
            : base(document, text, (int)symbolType, location, generated)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertValidString(text, "text");
            Param.Ignore(category);
            Param.Ignore(symbolType);
            Param.AssertNotNull(location, "location");
            Param.Ignore(generated);

            this.category = category;
            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(OperatorType), this.SymbolType), "The type is invalid.");
        }
コード例 #4
0
 /// <summary>
 /// Joins the locations of the two code units.
 /// </summary>
 /// <param name="location1">The first code unit.</param>
 /// <param name="codeUnit2">The second code unit.</param>
 /// <returns>Returns the joined location.</returns>
 internal static CodeLocation JoinLocations(CodeLocation location1, CodeUnit codeUnit2)
 {
     Param.Ignore(location1, codeUnit2);
     return(JoinLocations(codeUnit2, location1));
 }