本文整理汇总了C#中LockStatement类的典型用法代码示例。如果您正苦于以下问题:C# LockStatement类的具体用法?C# LockStatement怎么用?C# LockStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LockStatement类属于命名空间,在下文中一共展示了LockStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitLockStatement
public override void VisitLockStatement(LockStatement lockStatement)
{
ForceSpacesBefore(lockStatement.LParToken, policy.SpaceBeforeLockParentheses);
ForceSpacesAfter(lockStatement.LParToken, policy.SpacesWithinLockParentheses);
ForceSpacesBefore(lockStatement.RParToken, policy.SpacesWithinLockParentheses);
FixEmbeddedStatment(policy.StatementBraceStyle, policy.FixedBraceForcement, lockStatement.EmbeddedStatement);
}
示例2: VisitLockStatement
public override void VisitLockStatement(LockStatement lockStatement)
{
lockStatement.Expression.AcceptVisitor(this);
this.Output.Append(";");
this.Output.Append("\n");
this.IsNewLine = true;
lockStatement.EmbeddedStatement.AcceptVisitor(this);
}
示例3: VisitLockStatement
public StringBuilder VisitLockStatement(LockStatement lockStatement, int data)
{
throw new SLSharpException("SL# does not have locks.");
}
示例4: VisitLockStatement
public sealed override object VisitLockStatement(LockStatement lockStatement, object data) {
BeginVisit(lockStatement);
object result = TrackedVisitLockStatement(lockStatement, data);
EndVisit(lockStatement);
return result;
}
示例5: ParseLock
private Statement ParseLock(TokenSet followers)
//^ requires this.currentToken == Token.Lock;
//^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile;
{
SourceLocationBuilder slb = new SourceLocationBuilder(this.scanner.SourceLocationOfLastScannedToken);
this.GetNextToken();
Expression guard = this.ParseParenthesizedExpression(false, followers|Parser.StatementStart);
Statement body = this.ParseStatement(followers);
if (body is EmptyStatement)
this.HandleError(body.SourceLocation, Error.PossibleMistakenNullStatement);
slb.UpdateToSpan(body.SourceLocation);
Statement result = new LockStatement(guard, body, slb);
//^ assume followers[this.currentToken] || this.currentToken == Token.EndOfFile;
return result;
}
示例6: Visit
public override object Visit(Lock lockStatement)
{
var result = new LockStatement();
var location = LocationsBag.GetLocations(lockStatement);
result.AddChild(new CSharpTokenNode(Convert(lockStatement.loc), LockStatement.LockKeywordRole), LockStatement.LockKeywordRole);
if (location != null)
result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
if (lockStatement.Expr != null)
result.AddChild((Expression)lockStatement.Expr.Accept(this), Roles.Expression);
if (location != null && location.Count > 1)
result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
if (lockStatement.Statement != null)
result.AddChild((Statement)lockStatement.Statement.Accept(this), Roles.EmbeddedStatement);
return result;
}
示例7: Visit
public override object Visit (Lock lockStatement)
{
var result = new LockStatement ();
var location = LocationsBag.GetLocations (lockStatement);
result.AddChild (new CSharpTokenNode (Convert (lockStatement.loc), "lock".Length), LockStatement.Roles.Keyword);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), LockStatement.Roles.LPar);
result.AddChild ((INode)lockStatement.Expr.Accept (this), LockStatement.Roles.Expression);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), LockStatement.Roles.RPar);
result.AddChild ((INode)lockStatement.Statement.Accept (this), LockStatement.Roles.EmbeddedStatement);
return result;
}
示例8: VisitLockStatement
public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
Debug.Assert((lockStatement != null));
Debug.Assert((lockStatement.LockExpression != null));
Debug.Assert((lockStatement.EmbeddedStatement != null));
lockStatement.LockExpression.AcceptVisitor(this, data);
return lockStatement.EmbeddedStatement.AcceptVisitor(this, data);
}
示例9: EmbeddedStatement
//.........这里部分代码省略.........
lexer.NextToken();
#line 1585 "cs.ATG"
statement = new YieldStatement(new BreakStatement());
} else SynErr(198);
Expect(11);
} else if (la.kind == 101) {
lexer.NextToken();
if (StartOf(6)) {
Expr(
#line 1588 "cs.ATG"
out expr);
}
Expect(11);
#line 1588 "cs.ATG"
statement = new ReturnStatement(expr);
} else if (la.kind == 112) {
lexer.NextToken();
if (StartOf(6)) {
Expr(
#line 1589 "cs.ATG"
out expr);
}
Expect(11);
#line 1589 "cs.ATG"
statement = new ThrowStatement(expr);
} else if (StartOf(6)) {
StatementExpr(
#line 1592 "cs.ATG"
out statement);
while (!(la.kind == 0 || la.kind == 11)) {SynErr(199); lexer.NextToken(); }
Expect(11);
} else if (la.kind == 114) {
TryStatement(
#line 1595 "cs.ATG"
out statement);
} else if (la.kind == 86) {
lexer.NextToken();
Expect(20);
Expr(
#line 1598 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
#line 1599 "cs.ATG"
out embeddedStatement);
#line 1599 "cs.ATG"
statement = new LockStatement(expr, embeddedStatement);
} else if (la.kind == 121) {
#line 1602 "cs.ATG"
Statement resourceAcquisitionStmt = null;
lexer.NextToken();
Expect(20);
ResourceAcquisition(
#line 1604 "cs.ATG"
out resourceAcquisitionStmt);
Expect(21);
EmbeddedStatement(
#line 1605 "cs.ATG"
out embeddedStatement);
#line 1605 "cs.ATG"
statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement);
} else if (la.kind == 119) {
lexer.NextToken();
Block(
#line 1608 "cs.ATG"
out embeddedStatement);
#line 1608 "cs.ATG"
statement = new UnsafeStatement(embeddedStatement);
} else if (la.kind == 74) {
#line 1610 "cs.ATG"
Statement pointerDeclarationStmt = null;
lexer.NextToken();
Expect(20);
ResourceAcquisition(
#line 1612 "cs.ATG"
out pointerDeclarationStmt);
Expect(21);
EmbeddedStatement(
#line 1613 "cs.ATG"
out embeddedStatement);
#line 1613 "cs.ATG"
statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement);
} else SynErr(200);
#line 1615 "cs.ATG"
if (statement != null) {
statement.StartLocation = startLocation;
statement.EndLocation = t.EndLocation;
}
}
示例10: VisitLockStatement
public void VisitLockStatement(LockStatement node)
{
NotSupported(node);
}
示例11: VisitLockStatement
public void VisitLockStatement(LockStatement lockStatement)
{
JsonObject statement = CreateJsonStatement(lockStatement);
AddKeyword(statement, LockStatement.LockKeywordRole);
statement.AddJsonValue("expression", GenExpression(lockStatement.Expression));
statement.AddJsonValue("embedded-statement", GenStatement(lockStatement.EmbeddedStatement));
Push(statement);
}
示例12: VisitLockStatement
public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
throw new global::System.NotImplementedException("LockStatement");
}
示例13: EmbeddedStatement
//.........这里部分代码省略.........
statement = new YieldStatement(new ReturnStatement(expr));
}
else if (this.la.kind == 0x34)
{
base.lexer.NextToken();
statement = new YieldStatement(new BreakStatement());
}
else
{
base.SynErr(0xab);
}
base.Expect(11);
}
else if (this.la.kind == 100)
{
base.lexer.NextToken();
if (this.StartOf(5))
{
this.Expr(out expr);
}
base.Expect(11);
statement = new ReturnStatement(expr);
}
else if (this.la.kind == 0x6f)
{
base.lexer.NextToken();
if (this.StartOf(5))
{
this.Expr(out expr);
}
base.Expect(11);
statement = new ThrowStatement(expr);
}
else if (this.StartOf(5))
{
this.StatementExpr(out statement);
base.Expect(11);
}
else if (this.la.kind == 0x71)
{
this.TryStatement(out statement);
}
else if (this.la.kind == 0x55)
{
base.lexer.NextToken();
base.Expect(20);
this.Expr(out expr);
base.Expect(0x15);
this.EmbeddedStatement(out statement2);
statement = new LockStatement(expr, statement2);
}
else if (this.la.kind == 120)
{
ICSharpCode.NRefactory.Parser.AST.Statement stmt = null;
base.lexer.NextToken();
base.Expect(20);
this.ResourceAcquisition(out stmt);
base.Expect(0x15);
this.EmbeddedStatement(out statement2);
statement = new UsingStatement(stmt, statement2);
}
else if (this.la.kind == 0x76)
{
base.lexer.NextToken();
this.Block(out statement2);
statement = new UnsafeStatement(statement2);
}
else if (this.la.kind == 0x49)
{
base.lexer.NextToken();
base.Expect(20);
this.Type(out type);
if (type.PointerNestingLevel == 0)
{
this.Error("can only fix pointer types");
}
List<VariableDeclaration> pointerDeclarators = new List<VariableDeclaration>(1);
base.Expect(1);
string name = this.t.val;
base.Expect(3);
this.Expr(out expr);
pointerDeclarators.Add(new VariableDeclaration(name, expr));
while (this.la.kind == 14)
{
base.lexer.NextToken();
base.Expect(1);
name = this.t.val;
base.Expect(3);
this.Expr(out expr);
pointerDeclarators.Add(new VariableDeclaration(name, expr));
}
base.Expect(0x15);
this.EmbeddedStatement(out statement2);
statement = new FixedStatement(type, pointerDeclarators, statement2);
}
else
{
base.SynErr(0xac);
}
}
示例14: VisitLockStatement
public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
Debug.Assert((lockStatement != null));
Debug.Assert((lockStatement.LockExpression != null));
Debug.Assert((lockStatement.EmbeddedStatement != null));
nodeStack.Push(lockStatement.LockExpression);
lockStatement.LockExpression.AcceptVisitor(this, data);
lockStatement.LockExpression = ((Expression)(nodeStack.Pop()));
nodeStack.Push(lockStatement.EmbeddedStatement);
lockStatement.EmbeddedStatement.AcceptVisitor(this, data);
lockStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
return null;
}
示例15: VisitLockStatement
public virtual void VisitLockStatement(LockStatement lockStatement)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(lockStatement);
}
}