Пример #1
0
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     this.AwaitExpressions.Add(new Tuple <int, AstNode>(this.InvocationLevel, gotoCaseStatement));
     base.VisitGotoCaseStatement(gotoCaseStatement);
 }
		public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement) {
			var value = _resolver.Resolve(gotoCaseStatement.LabelExpression).ConstantValue;
			_result.Add(JsStatement.Goto(_currentGotoCaseMap[NormalizeSwitchLabelValue(value)]));
		}
Пример #3
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Check(stmt);
 }
 public override void VisitGotoCaseStatement(GotoCaseStatement syntax)
 {
     _underlyingVisitor.VisitGotoCaseStatement(syntax);
 }
Пример #5
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
 }
Пример #6
0
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     Found = true;
 }
Пример #7
0
        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
        {
            GotoCaseStatement o = other as GotoCaseStatement;

            return(o != null && this.LabelExpression.DoMatch(o.LabelExpression, match));
        }
 private bool IsMatch(GotoCaseStatement left, GotoCaseStatement data)
 {
     return(true);
 }
Пример #9
0
 public void VisitGotoCaseStatement(GotoCaseStatement node)
 {
     NotSupported(node);
 }
Пример #10
0
 private void GotoStatement(out ICSharpCode.NRefactory.Parser.AST.Statement stmt)
 {
     stmt = null;
     base.Expect(0x4d);
     if (this.la.kind == 1)
     {
         base.lexer.NextToken();
         stmt = new ICSharpCode.NRefactory.Parser.AST.GotoStatement(this.t.val);
         base.Expect(11);
     }
     else if (this.la.kind == 0x36)
     {
         Expression expression;
         base.lexer.NextToken();
         this.Expr(out expression);
         base.Expect(11);
         stmt = new GotoCaseStatement(expression);
     }
     else if (this.la.kind == 0x3e)
     {
         base.lexer.NextToken();
         base.Expect(11);
         stmt = new GotoCaseStatement(null);
     }
     else
     {
         base.SynErr(0xae);
     }
 }
		public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			throw new global::System.NotImplementedException("GotoCaseStatement");
		}
		public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			Debug.Assert((gotoCaseStatement != null));
			Debug.Assert((gotoCaseStatement.Expression != null));
			nodeStack.Push(gotoCaseStatement.Expression);
			gotoCaseStatement.Expression.AcceptVisitor(this, data);
			gotoCaseStatement.Expression = ((Expression)(nodeStack.Pop()));
			return null;
		}
Пример #13
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     SimpleResult(stmt);
 }
Пример #14
0
 /// <summary>
 /// Transforms a "goto case" statement. The default implementation places a new "goto case"
 /// statement inside the current case selection.
 /// </summary>
 /// <param name="stmt">"goto case" statement</param>
 public virtual void AcceptGotoCase(GotoCaseStatement stmt)
 {
     GotoCase(_caseMap[stmt.CaseStmt], stmt.TargetIndex);
     CopyAttributesToLastStatement(stmt);
 }
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     IsEmpty = false;
 }
 public object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
 {
     throw new NotImplementedException();
 }
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     throw NotSupportedToConsistency();
 }
 public virtual S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, T data)
 {
     return(VisitChildren(gotoCaseStatement, data));
 }
Пример #19
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     _execLeaf = stmt;
 }
Пример #20
0
        public void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
        {
            JsonObject statement = CreateJsonStatement(gotoCaseStatement);

            AddKeyword(statement, GotoCaseStatement.GotoKeywordRole);
            AddKeyword(statement, "case-keyword", GotoCaseStatement.CaseKeywordRole);
            statement.AddJsonValue("label-expression", GenExpression(gotoCaseStatement.LabelExpression));
            Push(statement);
            //implement already, but not tested
            throw new FirstTimeUseException();
        }
Пример #21
0
            public override ControlFlowNode VisitSwitchStatement(SwitchStatement switchStatement, ControlFlowNode data)
            {
                // First, figure out which switch section will get called (if the expression is constant):
                ResolveResult constant                 = builder.EvaluateConstant(switchStatement.Expression);
                SwitchSection defaultSection           = null;
                SwitchSection sectionMatchedByConstant = null;

                foreach (SwitchSection section in switchStatement.SwitchSections)
                {
                    foreach (CaseLabel label in section.CaseLabels)
                    {
                        if (label.Expression.IsNull)
                        {
                            defaultSection = section;
                        }
                        else if (constant != null && constant.IsCompileTimeConstant)
                        {
                            ResolveResult labelConstant = builder.EvaluateConstant(label.Expression);
                            if (builder.AreEqualConstants(constant, labelConstant))
                            {
                                sectionMatchedByConstant = section;
                            }
                        }
                    }
                }
                if (constant != null && constant.IsCompileTimeConstant && sectionMatchedByConstant == null)
                {
                    sectionMatchedByConstant = defaultSection;
                }

                int gotoCaseOrDefaultInOuterScope        = gotoCaseOrDefault.Count;
                List <ControlFlowNode> sectionStartNodes = new List <ControlFlowNode>();

                ControlFlowNode end = builder.CreateEndNode(switchStatement, addToNodeList: false);

                breakTargets.Push(end);
                foreach (SwitchSection section in switchStatement.SwitchSections)
                {
                    int sectionStartNodeID = builder.nodes.Count;
                    if (constant == null || !constant.IsCompileTimeConstant || section == sectionMatchedByConstant)
                    {
                        HandleStatementList(section.Statements, data);
                    }
                    else
                    {
                        // This section is unreachable: pass null to HandleStatementList.
                        HandleStatementList(section.Statements, null);
                    }
                    // Don't bother connecting the ends of the sections: the 'break' statement takes care of that.

                    // Store the section start node for 'goto case' statements.
                    sectionStartNodes.Add(sectionStartNodeID < builder.nodes.Count ? builder.nodes[sectionStartNodeID] : null);
                }
                breakTargets.Pop();
                if (defaultSection == null && sectionMatchedByConstant == null)
                {
                    Connect(data, end);
                }

                if (gotoCaseOrDefault.Count > gotoCaseOrDefaultInOuterScope)
                {
                    // Resolve 'goto case' statements:
                    for (int i = gotoCaseOrDefaultInOuterScope; i < gotoCaseOrDefault.Count; i++)
                    {
                        ControlFlowNode   gotoCaseNode      = gotoCaseOrDefault[i];
                        GotoCaseStatement gotoCaseStatement = gotoCaseNode.NextStatement as GotoCaseStatement;
                        ResolveResult     gotoCaseConstant  = null;
                        if (gotoCaseStatement != null)
                        {
                            gotoCaseConstant = builder.EvaluateConstant(gotoCaseStatement.LabelExpression);
                        }
                        int targetSectionIndex  = -1;
                        int currentSectionIndex = 0;
                        foreach (SwitchSection section in switchStatement.SwitchSections)
                        {
                            foreach (CaseLabel label in section.CaseLabels)
                            {
                                if (gotoCaseStatement != null)
                                {
                                    // goto case
                                    if (!label.Expression.IsNull)
                                    {
                                        ResolveResult labelConstant = builder.EvaluateConstant(label.Expression);
                                        if (builder.AreEqualConstants(gotoCaseConstant, labelConstant))
                                        {
                                            targetSectionIndex = currentSectionIndex;
                                        }
                                    }
                                }
                                else
                                {
                                    // goto default
                                    if (label.Expression.IsNull)
                                    {
                                        targetSectionIndex = currentSectionIndex;
                                    }
                                }
                            }
                            currentSectionIndex++;
                        }
                        if (targetSectionIndex >= 0 && sectionStartNodes[targetSectionIndex] != null)
                        {
                            Connect(gotoCaseNode, sectionStartNodes[targetSectionIndex], ControlFlowEdgeType.Jump);
                        }
                        else
                        {
                            Connect(gotoCaseNode, end, ControlFlowEdgeType.Jump);
                        }
                    }
                    gotoCaseOrDefault.RemoveRange(gotoCaseOrDefaultInOuterScope, gotoCaseOrDefault.Count - gotoCaseOrDefaultInOuterScope);
                }

                builder.nodes.Add(end);
                return(end);
            }
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     _errorReporter.Message(7998, gotoCaseStatement.GetRegion(), "goto case");
     _result = false;
 }
Пример #23
0
 /// <summary>
 /// Transforms a "goto case" statement. The default implementation places a new "goto case"
 /// statement inside the current case selection.
 /// </summary>
 /// <param name="stmt">"goto case" statement</param>
 public virtual void AcceptGotoCase(GotoCaseStatement stmt)
 {
     GotoCase(_caseMap[stmt.CaseStmt], stmt.TargetIndex);
     CopyAttributesToLastStatement(stmt);
 }
Пример #24
0
		public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			Debug.Assert((gotoCaseStatement != null));
			Debug.Assert((gotoCaseStatement.Expression != null));
			return gotoCaseStatement.Expression.AcceptVisitor(this, data);
		}
 public virtual void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(gotoCaseStatement);
     }
 }
Пример #26
0
 public Node VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     return(CreateDummy(gotoCaseStatement));
 }
Пример #27
0
			public override object Visit(GotoCase gotoCase)
			{
				var result = new GotoCaseStatement();
				result.AddChild(new CSharpTokenNode(Convert(gotoCase.loc), GotoCaseStatement.GotoKeywordRole), GotoCaseStatement.GotoKeywordRole);
				
				var location = LocationsBag.GetLocations(gotoCase);
				if (location != null)
					result.AddChild(new CSharpTokenNode(Convert(location [0]), GotoCaseStatement.CaseKeywordRole), GotoCaseStatement.CaseKeywordRole);
				if (gotoCase.Expr != null)
					result.AddChild((Expression)gotoCase.Expr.Accept(this), Roles.Expression);
				if (location != null && location.Count > 1)
					result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.Semicolon), Roles.Semicolon);
				return result;
			}
Пример #28
0
 public UnifiedElement VisitGotoCaseStatement(
     GotoCaseStatement gotoCaseStatement, object data)
 {
     return(UnifiedGoto.Create(UnifiedCase.Create(gotoCaseStatement.LabelExpression.TryAcceptForExpression(this))));
 }
		public sealed override object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			BeginVisit(gotoCaseStatement);
			object result = TrackedVisitGotoCaseStatement(gotoCaseStatement, data);
			EndVisit(gotoCaseStatement);
			return result;
		}
Пример #30
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     GotoCase(_caseMap[stmt.CaseStmt], stmt.TargetIndex);
 }
Пример #31
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Check(stmt);
 }
Пример #32
0
	void GotoStatement(
#line  1742 "cs.ATG" 
out Statement stmt) {

#line  1743 "cs.ATG" 
		Expression expr; stmt = null; 
		Expect(78);
		if (StartOf(19)) {
			Identifier();

#line  1747 "cs.ATG" 
			stmt = new GotoStatement(t.val); 
			Expect(11);
		} else if (la.kind == 55) {
			lexer.NextToken();
			Expr(
#line  1748 "cs.ATG" 
out expr);
			Expect(11);

#line  1748 "cs.ATG" 
			stmt = new GotoCaseStatement(expr); 
		} else if (la.kind == 63) {
			lexer.NextToken();
			Expect(11);

#line  1749 "cs.ATG" 
			stmt = new GotoCaseStatement(null); 
		} else SynErr(202);
	}
Пример #33
0
			public override object Visit (GotoCase gotoCase)
			{
				var result = new GotoCaseStatement ();
				result.AddChild (new CSharpTokenNode (Convert (gotoCase.loc), "goto".Length), GotoCaseStatement.Roles.Keyword);
				
				var location = LocationsBag.GetLocations (gotoCase);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), "case".Length), GotoCaseStatement.CaseKeywordRole);
				result.AddChild ((MonoDevelop.CSharp.Ast.Expression)gotoCase.Expr.Accept (this), GotoCaseStatement.Roles.Expression);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), GotoCaseStatement.Roles.Semicolon);
				return result;
			}
Пример #34
0
		public virtual void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
		{
			StartNode(gotoCaseStatement);
			DebugStart(gotoCaseStatement);
			WriteKeywordReferences(GotoCaseStatement.GotoKeywordRole, GotoCaseStatement.CaseKeywordRole, currentSwitchReference);
			Space();
			gotoCaseStatement.LabelExpression.AcceptVisitor(this);
			SemicolonDebugEnd(gotoCaseStatement);
			EndNode(gotoCaseStatement);
		}
 /// <inheritdoc/>
 public virtual void VisitGotoCaseStatement(GotoCaseStatement syntax)
 {
     VisitNode(syntax);
 }
Пример #36
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     IsEmpty = false;
 }
Пример #37
0
 public StringBuilder VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, int data)
 {
     throw new SLSharpException("SL# cannot jump from one case to another.");
 }
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Statement target = stmt.CaseStmt.Branches[stmt.TargetIndex];
     SingleResult(target.GetInnermostAtomicStatement());
 }
Пример #39
0
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     new GotoBlock(this, gotoCaseStatement).Emit();
 }
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     _result.Add(stmt);
 }
Пример #41
0
 public GotoBlock(IEmitter emitter, GotoCaseStatement gotoCaseStatement) : base(emitter, gotoCaseStatement)
 {
     GotoCaseStatement = gotoCaseStatement;
 }
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Result = stmt;
 }
Пример #43
0
 public override ControlFlowNode VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, ControlFlowNode data)
 {
     gotoCaseOrDefault.Add(data);
     return(builder.CreateEndNode(gotoCaseStatement));
 }
Пример #44
0
        public void CSharpGotoCaseDefaltStatementTest()
        {
            GotoCaseStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement <GotoCaseStatement>("goto default;");

            Assert.IsTrue(gotoCaseStmt.IsDefaultCase);
        }
Пример #45
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
 }
Пример #46
0
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     this.Add(gotoCaseStatement);
     base.VisitGotoCaseStatement(gotoCaseStatement);
 }
Пример #47
0
 public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
 {
     throw new global::System.NotImplementedException("GotoCaseStatement");
 }
Пример #48
0
 public void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     throw new NotImplementedException();
 }
Пример #49
0
 public override object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
 {
     gotoCases.Add(gotoCaseStatement);
     return(base.VisitGotoCaseStatement(gotoCaseStatement, data));
 }
Пример #50
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     SimpleResult(stmt);
 }
Пример #51
0
        public void AcceptGotoCase(GotoCaseStatement stmt)
        {
            Statement target = stmt.CaseStmt.Branches[stmt.TargetIndex];

            SingleResult(target.GetInnermostAtomicStatement());
        }
Пример #52
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Result = stmt;
 }
			public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement) {
				HandleGoto(NormalizeSwitchLabelValue(_resolver.Resolve(gotoCaseStatement.LabelExpression).ConstantValue));
			}
Пример #54
0
 public StringBuilder VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     throw new NotImplementedException();
 }
		public virtual void VisitGotoCaseStatement (GotoCaseStatement gotoCaseStatement)
		{
			VisitChildren (gotoCaseStatement);
		}
Пример #56
0
 public JNode VisitGotoCaseStatement(GotoCaseStatement node)
 {
     throw new NotImplementedException();
 }
Пример #57
0
		public void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
		{
			StartNode(gotoCaseStatement);
			WriteKeyword(GotoCaseStatement.GotoKeywordRole);
			WriteKeyword(GotoCaseStatement.CaseKeywordRole);
			Space();
			gotoCaseStatement.LabelExpression.AcceptVisitor(this);
			Semicolon();
			EndNode(gotoCaseStatement);
		}
		public virtual object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			return base.VisitGotoCaseStatement(gotoCaseStatement, data);
		}