public virtual Statement VisitResourceUse(ResourceUse resourceUse)
 {
     if (resourceUse == null) return null;
     resourceUse.ResourceAcquisition = (Statement)this.Visit(resourceUse.ResourceAcquisition);
     resourceUse.Body = this.VisitBlock(resourceUse.Body);
     return resourceUse;
 }
Exemple #2
0
 private ResourceUse ParseUsing(TokenSet followers){
   ResourceUse resourceUse = new ResourceUse();
   resourceUse.SourceContext = this.scanner.CurrentSourceContext;
   Debug.Assert(this.currentToken == Token.Using);
   this.GetNextToken();
   SourceContext sctx = this.scanner.CurrentSourceContext;
   if (Parser.IdentifierOrNonReservedKeyword[this.currentToken]){
     this.HandleError(Error.SyntaxError, "(");
     this.GetNextToken();
     if (this.currentToken == Token.Semicolon)
       this.GetNextToken();
     this.SkipTo(followers);
     return null;
   }
   this.Skip(Token.LeftParenthesis);
   resourceUse.ResourceAcquisition = this.ParseExpressionStatementOrDeclaration(false, followers|Token.RightParenthesis|Parser.StatementStart, false, false);
   this.ParseBracket(sctx, Token.RightParenthesis, followers|Parser.StatementStart, Error.ExpectedRightParenthesis);
   Block b = this.ParseStatementAsBlock(followers);
   resourceUse.Body = b;
   if (b != null)
     resourceUse.SourceContext.EndPos = b.SourceContext.EndPos;
   return resourceUse;
 }
Exemple #3
0
 public override Statement VisitResourceUse(ResourceUse resourceUse)
 {
     if (resourceUse == null) return null;
     return base.VisitResourceUse((ResourceUse)resourceUse.Clone());
 }
 public EventingVisitor(Action<ResourceUse> visitResourceUse) { VisitedResourceUse += visitResourceUse; } public event Action<ResourceUse> VisitedResourceUse; public override Statement VisitResourceUse(ResourceUse resourceUse) { if (VisitedResourceUse != null) VisitedResourceUse(resourceUse); return base.VisitResourceUse(resourceUse); }