コード例 #1
0
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     this.AwaitExpressions.Add(new Tuple <int, AstNode>(this.InvocationLevel, gotoCaseStatement));
     base.VisitGotoCaseStatement(gotoCaseStatement);
 }
コード例 #2
0
		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);
 }
コード例 #4
0
 public override void VisitGotoCaseStatement(GotoCaseStatement syntax)
 {
     _underlyingVisitor.VisitGotoCaseStatement(syntax);
 }
コード例 #5
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
 }
コード例 #6
0
ファイル: GotoSearchVisitor.cs プロジェクト: theolivenbaum/h5
 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));
        }
コード例 #8
0
 private bool IsMatch(GotoCaseStatement left, GotoCaseStatement data)
 {
     return(true);
 }
コード例 #9
0
ファイル: Lower.cs プロジェクト: evanw/minisharp
 public void VisitGotoCaseStatement(GotoCaseStatement node)
 {
     NotSupported(node);
 }
コード例 #10
0
ファイル: Parser.cs プロジェクト: KnowNo/test-code-backup
 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);
     }
 }
コード例 #11
0
		public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			throw new global::System.NotImplementedException("GotoCaseStatement");
		}
コード例 #12
0
		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);
 }
コード例 #15
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     IsEmpty = false;
 }
コード例 #16
0
 public object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     throw NotSupportedToConsistency();
 }
コード例 #18
0
 public virtual S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, T data)
 {
     return(VisitChildren(gotoCaseStatement, data));
 }
コード例 #19
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     _execLeaf = stmt;
 }
コード例 #20
0
ファイル: AstCsToJson.cs プロジェクト: CompilerKit/CodeWalk
        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);
            }
コード例 #22
0
 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);
		}
コード例 #25
0
 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
ファイル: CSharpParser.cs プロジェクト: 0xb1dd1e/NRefactory
			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))));
 }
コード例 #29
0
		public sealed override object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			BeginVisit(gotoCaseStatement);
			object result = TrackedVisitGotoCaseStatement(gotoCaseStatement, data);
			EndVisit(gotoCaseStatement);
			return result;
		}
コード例 #30
0
ファイル: RetRemoval.cs プロジェクト: venusdharan/systemsharp
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     GotoCase(_caseMap[stmt.CaseStmt], stmt.TargetIndex);
 }
コード例 #31
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Check(stmt);
 }
コード例 #32
0
ファイル: Parser.cs プロジェクト: mgagne-atman/Projects
	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);
		}
コード例 #35
0
 /// <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.");
 }
コード例 #38
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     Statement target = stmt.CaseStmt.Branches[stmt.TargetIndex];
     SingleResult(target.GetInnermostAtomicStatement());
 }
コード例 #39
0
ファイル: Emitter.Visitor.cs プロジェクト: theolivenbaum/h5
 public override void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
 {
     new GotoBlock(this, gotoCaseStatement).Emit();
 }
コード例 #40
0
 public void AcceptGotoCase(GotoCaseStatement stmt)
 {
     _result.Add(stmt);
 }
コード例 #41
0
 public GotoBlock(IEmitter emitter, GotoCaseStatement gotoCaseStatement) : base(emitter, gotoCaseStatement)
 {
     GotoCaseStatement = gotoCaseStatement;
 }
コード例 #42
0
 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
ファイル: TempEmitter.cs プロジェクト: yctri/Bridge
 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;
 }
コード例 #53
0
			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
ファイル: CSharpOutputVisitor.cs プロジェクト: x-strong/ILSpy
		public void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement)
		{
			StartNode(gotoCaseStatement);
			WriteKeyword(GotoCaseStatement.GotoKeywordRole);
			WriteKeyword(GotoCaseStatement.CaseKeywordRole);
			Space();
			gotoCaseStatement.LabelExpression.AcceptVisitor(this);
			Semicolon();
			EndNode(gotoCaseStatement);
		}
コード例 #58
0
		public virtual object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
			return base.VisitGotoCaseStatement(gotoCaseStatement, data);
		}