Exemplo n.º 1
0
 void ITreeWalker.Visit(MatchStatement statement)
 {
     statement.Validate(this);
     InsertMatch(() => statement.Reference.Accept(this), () =>
     {
         _loops.Push(true);
         statement.Cases.Accept(this);
         _loops.Pop();
     });
 }
Exemplo n.º 2
0
 public void Visit(MatchStatement matchstmt)
 {
     Console.Write("match (");
     matchstmt.expression.Accept(this);
     Console.WriteLine(") {");
     foreach (var matchcase in matchstmt.matchCases)
     {
         Console.Write($"\t{matchcase.Type} : ");
         matchcase.Statement.Accept(this);
         Console.WriteLine();
     }
     if (matchstmt.defaultCase != null)
     {
         Console.Write("\tdefault : ");
         matchstmt.defaultCase.Accept(this);
     }
     Console.WriteLine();
     Console.WriteLine("}");
 }
Exemplo n.º 3
0
        void ITreeWalker.Visit(MatchStatement statement)
        {
            var name = "^~#" + _loops.Count;

            statement.Validate(this);
            statement.Reference.Accept(this);
            _operations.Add(new SetsOperation(name));
            InsertJump(_operations.Count + 1);
            var jumpToEnd = InsertMarker();

            _loops.Push(new LoopInfo {
                Break = jumpToEnd, Continue = jumpToEnd
            });
            statement.Cases.Accept(this);
            _loops.Pop();
            var end = _operations.Count;

            _operations.Add(new DelVarOperation(name));
            _operations.Add(PopOperation.Instance);
            InsertJump(jumpToEnd, end - 1);
        }
Exemplo n.º 4
0
        public void VisitMatchStatement(MatchStatement matchStmt)
        {
            int tmp_counter = scope_counter;
            DecendScope();
            scope_counter = 0;

            matchStmt.Target.AcceptWalker(this);
            matchStmt.Clauses.AcceptWalker(this);

            AscendScope();
            scope_counter = tmp_counter + 1;
        }
Exemplo n.º 5
0
 internal CaseStatementBuilder(MatchStatement <D> statement, Action <ParameterExpression> scope)
 {
     this.scope     = scope;
     this.statement = statement;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Visits a match statement - accepts the condition and body.
 /// </summary>
 public virtual void Visit(MatchStatement statement)
 {
     statement.Reference.Accept(this);
     statement.Cases.Accept(this);
 }
 void ITreeWalker.Visit(MatchStatement statement)
 {
     Header("Statement/Match");
     WriteProperty("Reference", statement.Reference);
     WriteProperty("Cases", statement.Cases);
 }
Exemplo n.º 8
0
 public void VisitMatchStatement(MatchStatement matchStmt)
 {
 }
 void ITreeWalker.Visit(MatchStatement statement)
 {
     statement.Validate(this);
     statement.Reference.Accept(this);
     statement.Cases.Accept(this);
 }
Exemplo n.º 10
0
 public void Visit(MatchStatement matchStatement)
 {
 }