本文整理汇总了C#中SourceSpan类的典型用法代码示例。如果您正苦于以下问题:C# SourceSpan类的具体用法?C# SourceSpan怎么用?C# SourceSpan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SourceSpan类属于命名空间,在下文中一共展示了SourceSpan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoStatementBuilder
internal DoStatementBuilder(SourceSpan statementSpan, SourceLocation location, Statement body) {
Contract.RequiresNotNull(body, "body");
_body = body;
_doLocation = location;
_statementSpan = statementSpan;
}
示例2: Catch
public static CatchBlock Catch(SourceSpan span, SourceLocation header, Type type, Variable target, Statement body)
{
Contract.RequiresNotNull(type, "type");
Contract.Requires(target == null || TypeUtils.CanAssign(target.Type, type), "target");
Contract.RequiresNotNull(body, "body");
return new CatchBlock(span, header, type, target, body);
}
示例3: TryCatchFinally
public static TryStatement TryCatchFinally(SourceSpan span, SourceLocation header, Statement body, CatchBlock[] handlers, Statement @finally)
{
return new TryStatement(
span, header,
body, CollectionUtils.ToReadOnlyCollection(handlers), @finally
);
}
示例4: Scope
public static ScopeStatement Scope(SourceSpan span, Expression scope, Statement body) {
Contract.RequiresNotNull(scope, "scope");
Contract.RequiresNotNull(body, "body");
Contract.Requires(TypeUtils.CanAssign(typeof(IAttributesCollection), scope.Type), "scope", "Scope must be IAttributesCollection");
return new ScopeStatement(span, scope, body);
}
示例5: Throw
public static ThrowStatement Throw(SourceSpan span, Expression value)
{
if (value != null) {
Contract.Requires(TypeUtils.CanAssign(typeof(Exception), value.Type));
}
return new ThrowStatement(span, value);
}
示例6: Switch
public static SwitchStatement Switch(SourceSpan span, SourceLocation header, Expression value, params SwitchCase[] cases)
{
Contract.RequiresNotNull(value, "value");
Contract.Requires(value.Type == typeof(int), "value", "Value must be int");
Contract.RequiresNotEmpty(cases, "cases");
Contract.RequiresNotNullItems(cases, "cases");
bool @default = false;
int max = Int32.MinValue;
int min = Int32.MaxValue;
foreach (SwitchCase sc in cases) {
if (sc.IsDefault) {
Contract.Requires(@default == false, "cases", "Only one default clause allowed");
@default = true;
} else {
int val = sc.Value;
if (val > max) max = val;
if (val < min) min = val;
}
}
Contract.Requires(UniqueCaseValues(cases, min, max), "cases", "Case values must be unique");
return new SwitchStatement(span, header, value, CollectionUtils.ToReadOnlyCollection(cases));
}
示例7: CustomErrorCorrection
public CustomErrorCorrection(int errorId, SourceSpan errorSpan, params object[] parameters)
: base(CorrectionMethod.Custom)
{
ErrorId = errorId;
ErrorSpan = errorSpan;
Parameters = parameters;
}
示例8: LexemeValue
public LexemeValue(string content, SourceSpan span)
{
CodeContract.RequiresArgumentNotNull(span, "span");
Content = content;
Span = span;
}
示例9: DoStatement
/// <summary>
/// Called by <see cref="DoStatementBuilder"/>.
/// </summary>
internal DoStatement(SourceSpan span, SourceLocation header, Expression /*!*/ test, Statement /*!*/ body)
: base(AstNodeType.DoStatement, span)
{
_header = header;
_test = test;
_body = body;
}
示例10: LoopStatement
/// <summary>
/// Null test means infinite loop.
/// </summary>
internal LoopStatement(SourceSpan span, SourceLocation header, Expression test, Expression increment, Statement /*!*/ body, Statement @else)
: base(AstNodeType.LoopStatement, span) {
_test = test;
_increment = increment;
_body = body;
_else = @else;
_header = header;
}
示例11: IfCondition
public static IfStatementTest IfCondition(SourceSpan span, SourceLocation header, Expression test, Statement body)
{
Contract.RequiresNotNull(test, "test");
Contract.RequiresNotNull(body, "body");
Contract.Requires(test.Type == typeof(bool), "test", "Test must be boolean");
return new IfStatementTest(span, header, test, body);
}
示例12: SwitchStatement
internal SwitchStatement(SourceSpan span, SourceLocation header, Expression/*!*/ testValue, ReadOnlyCollection<SwitchCase>/*!*/ cases)
: base(AstNodeType.SwitchStatement, span) {
Assert.NotNullItems(cases);
_testValue = testValue;
_cases = cases;
_header = header;
}
示例13: Lexeme
internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string value, int skippedTokenCount)
{
m_scannerInfo = scannerInfo;
m_stateIndex = state;
Span = span;
Value = value;
SkippedTokenCount = skippedTokenCount;
}
示例14: Lexeme
internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string content)
{
m_scannerInfo = scannerInfo;
m_stateIndex = state;
Value = new LexemeValue(content, span);
m_trivia = s_emptyTrivia;
}
示例15: TryStatement
/// <summary>
/// Called by <see cref="TryStatementBuilder"/>.
/// Creates a try/catch/finally/else block.
///
/// The body is protected by the try block.
/// The handlers consist of a set of language-dependent tests which call into the LanguageContext.
/// The elseSuite runs if no exception is thrown.
/// The finallySuite runs regardless of how control exits the body.
/// </summary>
internal TryStatement(SourceSpan span, SourceLocation header, Statement body, ReadOnlyCollection<CatchBlock> handlers, Statement @finally)
: base(AstNodeType.TryStatement, span)
{
_body = body;
_handlers = handlers;
_finally = @finally;
_header = header;
}