Exemplo n.º 1
0
 public virtual void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     if (this.ThrowException)
     {
         throw (System.Exception) this.CreateException(unsafeStatement);
     }
 }
Exemplo n.º 2
0
 public virtual object Visit(UnsafeStatement unsafeStatement, object data)
 {
     Debug.Assert(unsafeStatement != null);
     Debug.Assert(unsafeStatement.Block != null);
     unsafeStatement.Block.AcceptVisitor(this, data);
     return(data);
 }
Exemplo n.º 3
0
 public virtual void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     if (ThrowException)
     {
         throw (Exception)CreateException(unsafeStatement);
     }
 }
Exemplo n.º 4
0
            public override void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
            {
                unsafeStateStack.Peek().UseUnsafeConstructs = true;
                bool isRedundant = unsafeStateStack.Peek().InUnsafeContext;

                unsafeStateStack.Push(new UnsafeState(true));
                base.VisitUnsafeStatement(unsafeStatement);
                isRedundant |= !unsafeStateStack.Pop().UseUnsafeConstructs;

                if (isRedundant)
                {
                    AddIssue(new CodeIssue(
                                 unsafeStatement.UnsafeToken,
                                 ctx.TranslateString("'unsafe' statement is redundant."),
                                 ctx.TranslateString("Replace 'unsafe' statement with it's body"),
                                 s => {
                        s.Remove(unsafeStatement.UnsafeToken);
                        s.Remove(unsafeStatement.Body.LBraceToken);
                        s.Remove(unsafeStatement.Body.RBraceToken);
                        s.FormatText(unsafeStatement.Parent);
                    }
                                 ));
                }
            }
Exemplo n.º 5
0
			public override object Visit (Unsafe unsafeStatement)
			{
				var result = new UnsafeStatement ();
				result.AddChild (new CSharpTokenNode (Convert (unsafeStatement.loc), "unsafe".Length), UnsafeStatement.Roles.Keyword);
				result.AddChild ((INode)unsafeStatement.Block.Accept (this), UnsafeStatement.Roles.Body);
				return result;
			}
		public override void VisitUnsafeStatement(UnsafeStatement unsafeStatement) {
			throw new InvalidOperationException("unsafe statement is not supported");	// Should be caught during the compilation step.
		}
 public override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     base.VisitUnsafeStatement(unsafeStatement, data);
     ReplaceCurrentNode(unsafeStatement.Block);
     return(null);
 }
        public void CSharpUnsafeStatementTest()
        {
            UnsafeStatement unsafeStatement = ParseUtilCSharp.ParseStatement <UnsafeStatement>("unsafe { }");

            Assert.IsFalse(unsafeStatement.Block.IsNull);
        }
Exemplo n.º 9
0
 public StringBuilder VisitUnsafeStatement(UnsafeStatement unsafeStatement, int data)
 {
     throw new ASLException("ASL does not allow unsafe code.");
 }
		public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			throw new global::System.NotImplementedException("UnsafeStatement");
		}
Exemplo n.º 11
0
 public RedILNode VisitUnsafeStatement(UnsafeStatement unsafeStatement, State data)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 12
0
 private void EmbeddedStatement(out ICSharpCode.NRefactory.Parser.AST.Statement statement)
 {
     TypeReference type = null;
     Expression expr = null;
     ICSharpCode.NRefactory.Parser.AST.Statement statement2 = null;
     statement = null;
     if (this.la.kind == 0x10)
     {
         this.Block(out statement);
     }
     else if (this.la.kind == 11)
     {
         base.lexer.NextToken();
         statement = new EmptyStatement();
     }
     else if (this.UnCheckedAndLBrace())
     {
         ICSharpCode.NRefactory.Parser.AST.Statement statement3;
         bool flag = true;
         if (this.la.kind == 0x39)
         {
             base.lexer.NextToken();
         }
         else if (this.la.kind == 0x75)
         {
             base.lexer.NextToken();
             flag = false;
         }
         else
         {
             base.SynErr(170);
         }
         this.Block(out statement3);
         statement = flag ? ((ICSharpCode.NRefactory.Parser.AST.Statement) new CheckedStatement(statement3)) : ((ICSharpCode.NRefactory.Parser.AST.Statement) new UncheckedStatement(statement3));
     }
     else if (this.la.kind == 0x4e)
     {
         base.lexer.NextToken();
         ICSharpCode.NRefactory.Parser.AST.Statement statement4 = null;
         base.Expect(20);
         this.Expr(out expr);
         base.Expect(0x15);
         this.EmbeddedStatement(out statement2);
         if (this.la.kind == 0x42)
         {
             base.lexer.NextToken();
             this.EmbeddedStatement(out statement4);
         }
         statement = (statement4 != null) ? new IfElseStatement(expr, statement2, statement4) : new IfElseStatement(expr, statement2);
         if ((statement4 is IfElseStatement) && ((statement4 as IfElseStatement).TrueStatement.Count == 1))
         {
             (statement as IfElseStatement).ElseIfSections.Add(new ElseIfSection((statement4 as IfElseStatement).Condition, (statement4 as IfElseStatement).TrueStatement[0]));
             (statement as IfElseStatement).ElseIfSections.AddRange((statement4 as IfElseStatement).ElseIfSections);
             (statement as IfElseStatement).FalseStatement = (statement4 as IfElseStatement).FalseStatement;
         }
     }
     else if (this.la.kind == 0x6d)
     {
         base.lexer.NextToken();
         List<ICSharpCode.NRefactory.Parser.AST.SwitchSection> switchSections = new List<ICSharpCode.NRefactory.Parser.AST.SwitchSection>();
         base.Expect(20);
         this.Expr(out expr);
         base.Expect(0x15);
         base.Expect(0x10);
         while ((this.la.kind == 0x36) || (this.la.kind == 0x3e))
         {
             ICSharpCode.NRefactory.Parser.AST.SwitchSection section;
             this.SwitchSection(out section);
             switchSections.Add(section);
         }
         base.Expect(0x11);
         statement = new SwitchStatement(expr, switchSections);
     }
     else if (this.la.kind == 0x7c)
     {
         base.lexer.NextToken();
         base.Expect(20);
         this.Expr(out expr);
         base.Expect(0x15);
         this.EmbeddedStatement(out statement2);
         statement = new DoLoopStatement(expr, statement2, ConditionType.While, ConditionPosition.Start);
     }
     else if (this.la.kind == 0x40)
     {
         base.lexer.NextToken();
         this.EmbeddedStatement(out statement2);
         base.Expect(0x7c);
         base.Expect(20);
         this.Expr(out expr);
         base.Expect(0x15);
         base.Expect(11);
         statement = new DoLoopStatement(expr, statement2, ConditionType.While, ConditionPosition.End);
     }
     else if (this.la.kind == 0x4b)
     {
         base.lexer.NextToken();
         List<ICSharpCode.NRefactory.Parser.AST.Statement> initializer = null;
         List<ICSharpCode.NRefactory.Parser.AST.Statement> iterator = null;
         base.Expect(20);
         if (this.StartOf(5))
         {
             this.ForInitializer(out initializer);
         }
         base.Expect(11);
         if (this.StartOf(5))
         {
             this.Expr(out expr);
         }
         base.Expect(11);
         if (this.StartOf(5))
         {
             this.ForIterator(out iterator);
         }
         base.Expect(0x15);
         this.EmbeddedStatement(out statement2);
         statement = new ForStatement(initializer, expr, iterator, statement2);
     }
     else if (this.la.kind == 0x4c)
     {
         base.lexer.NextToken();
         base.Expect(20);
         this.Type(out type);
         base.Expect(1);
         string val = this.t.val;
         Point location = this.t.Location;
         base.Expect(80);
         this.Expr(out expr);
         base.Expect(0x15);
         this.EmbeddedStatement(out statement2);
         statement = new ForeachStatement(type, val, expr, statement2);
         statement.EndLocation = this.t.EndLocation;
     }
     else if (this.la.kind == 0x34)
     {
         base.lexer.NextToken();
         base.Expect(11);
         statement = new BreakStatement();
     }
     else if (this.la.kind == 60)
     {
         base.lexer.NextToken();
         base.Expect(11);
         statement = new ContinueStatement();
     }
     else if (this.la.kind == 0x4d)
     {
         this.GotoStatement(out statement);
     }
     else if (this.IsYieldStatement())
     {
         base.Expect(1);
         if (this.la.kind == 100)
         {
             base.lexer.NextToken();
             this.Expr(out expr);
             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);
     }
 }
Exemplo n.º 13
0
		public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			Debug.Assert((unsafeStatement != null));
			Debug.Assert((unsafeStatement.Block != null));
			nodeStack.Push(unsafeStatement.Block);
			unsafeStatement.Block.AcceptVisitor(this, data);
			unsafeStatement.Block = ((Statement)(nodeStack.Pop()));
			return null;
		}
Exemplo n.º 14
0
        public static Doc Print(SyntaxNode syntaxNode)
        {
            if (syntaxNode == null)
            {
                return(Doc.Null);
            }

            // TODO 0 kill? runtime repo has files that will fail on deep recursion
            if (depth > 200)
            {
                throw new InTooDeepException();
            }

            depth++;
            try
            {
                switch (syntaxNode)
                {
                case AliasQualifiedNameSyntax aliasQualifiedNameSyntax:
                    return(AliasQualifiedName.Print(aliasQualifiedNameSyntax));

                case AnonymousMethodExpressionSyntax anonymousMethodExpressionSyntax:
                    return(AnonymousMethodExpression.Print(anonymousMethodExpressionSyntax));

                case AnonymousObjectCreationExpressionSyntax anonymousObjectCreationExpressionSyntax:
                    return(AnonymousObjectCreationExpression.Print(
                               anonymousObjectCreationExpressionSyntax
                               ));

                case AnonymousObjectMemberDeclaratorSyntax anonymousObjectMemberDeclaratorSyntax:
                    return(AnonymousObjectMemberDeclarator.Print(
                               anonymousObjectMemberDeclaratorSyntax
                               ));

                case ArgumentListSyntax argumentListSyntax:
                    return(ArgumentList.Print(argumentListSyntax));

                case ArgumentSyntax argumentSyntax:
                    return(Argument.Print(argumentSyntax));

                case ArrayCreationExpressionSyntax arrayCreationExpressionSyntax:
                    return(ArrayCreationExpression.Print(arrayCreationExpressionSyntax));

                case ArrayRankSpecifierSyntax arrayRankSpecifierSyntax:
                    return(ArrayRankSpecifier.Print(arrayRankSpecifierSyntax));

                case ArrayTypeSyntax arrayTypeSyntax:
                    return(ArrayType.Print(arrayTypeSyntax));

                case ArrowExpressionClauseSyntax arrowExpressionClauseSyntax:
                    return(ArrowExpressionClause.Print(arrowExpressionClauseSyntax));

                case AssignmentExpressionSyntax assignmentExpressionSyntax:
                    return(AssignmentExpression.Print(assignmentExpressionSyntax));

                case AttributeListSyntax attributeListSyntax:
                    return(AttributeList.Print(attributeListSyntax));

                case AwaitExpressionSyntax awaitExpressionSyntax:
                    return(AwaitExpression.Print(awaitExpressionSyntax));

                case BaseExpressionSyntax baseExpressionSyntax:
                    return(BaseExpression.Print(baseExpressionSyntax));

                case BaseFieldDeclarationSyntax baseFieldDeclarationSyntax:
                    return(BaseFieldDeclaration.Print(baseFieldDeclarationSyntax));

                case BaseListSyntax baseListSyntax:
                    return(BaseList.Print(baseListSyntax));

                case BaseMethodDeclarationSyntax baseMethodDeclarationSyntax:
                    return(BaseMethodDeclaration.Print(baseMethodDeclarationSyntax));

                case BasePropertyDeclarationSyntax basePropertyDeclarationSyntax:
                    return(BasePropertyDeclaration.Print(basePropertyDeclarationSyntax));

                case BaseTypeDeclarationSyntax baseTypeDeclarationSyntax:
                    return(BaseTypeDeclaration.Print(baseTypeDeclarationSyntax));

                case BinaryExpressionSyntax binaryExpressionSyntax:
                    return(BinaryExpression.Print(binaryExpressionSyntax));

                case BinaryPatternSyntax binaryPatternSyntax:
                    return(BinaryPattern.Print(binaryPatternSyntax));

                case BlockSyntax blockSyntax:
                    return(Block.Print(blockSyntax));

                case BracketedArgumentListSyntax bracketedArgumentListSyntax:
                    return(BracketedArgumentList.Print(bracketedArgumentListSyntax));

                case BracketedParameterListSyntax bracketedParameterListSyntax:
                    return(BracketedParameterList.Print(bracketedParameterListSyntax));

                case BreakStatementSyntax breakStatementSyntax:
                    return(BreakStatement.Print(breakStatementSyntax));

                case CasePatternSwitchLabelSyntax casePatternSwitchLabelSyntax:
                    return(CasePatternSwitchLabel.Print(casePatternSwitchLabelSyntax));

                case CaseSwitchLabelSyntax caseSwitchLabelSyntax:
                    return(CaseSwitchLabel.Print(caseSwitchLabelSyntax));

                case CastExpressionSyntax castExpressionSyntax:
                    return(CastExpression.Print(castExpressionSyntax));

                case CatchClauseSyntax catchClauseSyntax:
                    return(CatchClause.Print(catchClauseSyntax));

                case CheckedExpressionSyntax checkedExpressionSyntax:
                    return(CheckedExpression.Print(checkedExpressionSyntax));

                case CheckedStatementSyntax checkedStatementSyntax:
                    return(CheckedStatement.Print(checkedStatementSyntax));

                case ClassOrStructConstraintSyntax classOrStructConstraintSyntax:
                    return(ClassOrStructConstraint.Print(classOrStructConstraintSyntax));

                case CompilationUnitSyntax compilationUnitSyntax:
                    return(CompilationUnit.Print(compilationUnitSyntax));

                case ConditionalAccessExpressionSyntax conditionalAccessExpressionSyntax:
                    return(ConditionalAccessExpression.Print(conditionalAccessExpressionSyntax));

                case ConditionalExpressionSyntax conditionalExpressionSyntax:
                    return(ConditionalExpression.Print(conditionalExpressionSyntax));

                case ConstantPatternSyntax constantPatternSyntax:
                    return(ConstantPattern.Print(constantPatternSyntax));

                case ConstructorConstraintSyntax constructorConstraintSyntax:
                    return(ConstructorConstraint.Print(constructorConstraintSyntax));

                case ConstructorInitializerSyntax constructorInitializerSyntax:
                    return(ConstructorInitializer.Print(constructorInitializerSyntax));

                case ContinueStatementSyntax continueStatementSyntax:
                    return(ContinueStatement.Print(continueStatementSyntax));

                case DeclarationExpressionSyntax declarationExpressionSyntax:
                    return(DeclarationExpression.Print(declarationExpressionSyntax));

                case DeclarationPatternSyntax declarationPatternSyntax:
                    return(DeclarationPattern.Print(declarationPatternSyntax));

                case DefaultConstraintSyntax defaultConstraintSyntax:
                    return(DefaultConstraint.Print(defaultConstraintSyntax));

                case DefaultExpressionSyntax defaultExpressionSyntax:
                    return(DefaultExpression.Print(defaultExpressionSyntax));

                case DefaultSwitchLabelSyntax defaultSwitchLabelSyntax:
                    return(DefaultSwitchLabel.Print(defaultSwitchLabelSyntax));

                case DelegateDeclarationSyntax delegateDeclarationSyntax:
                    return(DelegateDeclaration.Print(delegateDeclarationSyntax));

                case DiscardDesignationSyntax discardDesignationSyntax:
                    return(DiscardDesignation.Print(discardDesignationSyntax));

                case DiscardPatternSyntax discardPatternSyntax:
                    return(DiscardPattern.Print(discardPatternSyntax));

                case DoStatementSyntax doStatementSyntax:
                    return(DoStatement.Print(doStatementSyntax));

                case ElementAccessExpressionSyntax elementAccessExpressionSyntax:
                    return(ElementAccessExpression.Print(elementAccessExpressionSyntax));

                case ElementBindingExpressionSyntax elementBindingExpressionSyntax:
                    return(ElementBindingExpression.Print(elementBindingExpressionSyntax));

                case ElseClauseSyntax elseClauseSyntax:
                    return(ElseClause.Print(elseClauseSyntax));

                case EmptyStatementSyntax emptyStatementSyntax:
                    return(EmptyStatement.Print(emptyStatementSyntax));

                case EnumMemberDeclarationSyntax enumMemberDeclarationSyntax:
                    return(EnumMemberDeclaration.Print(enumMemberDeclarationSyntax));

                case EqualsValueClauseSyntax equalsValueClauseSyntax:
                    return(EqualsValueClause.Print(equalsValueClauseSyntax));

                case ExpressionStatementSyntax expressionStatementSyntax:
                    return(ExpressionStatement.Print(expressionStatementSyntax));

                case ExternAliasDirectiveSyntax externAliasDirectiveSyntax:
                    return(ExternAliasDirective.Print(externAliasDirectiveSyntax));

                case FinallyClauseSyntax finallyClauseSyntax:
                    return(FinallyClause.Print(finallyClauseSyntax));

                case FixedStatementSyntax fixedStatementSyntax:
                    return(FixedStatement.Print(fixedStatementSyntax));

                case ForEachStatementSyntax forEachStatementSyntax:
                    return(ForEachStatement.Print(forEachStatementSyntax));

                case ForEachVariableStatementSyntax forEachVariableStatementSyntax:
                    return(ForEachVariableStatement.Print(forEachVariableStatementSyntax));

                case ForStatementSyntax forStatementSyntax:
                    return(ForStatement.Print(forStatementSyntax));

                case FromClauseSyntax fromClauseSyntax:
                    return(FromClause.Print(fromClauseSyntax));

                case FunctionPointerTypeSyntax functionPointerTypeSyntax:
                    return(FunctionPointerType.Print(functionPointerTypeSyntax));

                case GenericNameSyntax genericNameSyntax:
                    return(GenericName.Print(genericNameSyntax));

                case GlobalStatementSyntax globalStatementSyntax:
                    return(GlobalStatement.Print(globalStatementSyntax));

                case GotoStatementSyntax gotoStatementSyntax:
                    return(GotoStatement.Print(gotoStatementSyntax));

                case GroupClauseSyntax groupClauseSyntax:
                    return(GroupClause.Print(groupClauseSyntax));

                case IdentifierNameSyntax identifierNameSyntax:
                    return(IdentifierName.Print(identifierNameSyntax));

                case IfStatementSyntax ifStatementSyntax:
                    return(IfStatement.Print(ifStatementSyntax));

                case ImplicitArrayCreationExpressionSyntax implicitArrayCreationExpressionSyntax:
                    return(ImplicitArrayCreationExpression.Print(
                               implicitArrayCreationExpressionSyntax
                               ));

                case ImplicitElementAccessSyntax implicitElementAccessSyntax:
                    return(ImplicitElementAccess.Print(implicitElementAccessSyntax));

                case ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpressionSyntax:
                    return(ImplicitObjectCreationExpression.Print(
                               implicitObjectCreationExpressionSyntax
                               ));

                case ImplicitStackAllocArrayCreationExpressionSyntax implicitStackAllocArrayCreationExpressionSyntax:
                    return(ImplicitStackAllocArrayCreationExpression.Print(
                               implicitStackAllocArrayCreationExpressionSyntax
                               ));

                case IncompleteMemberSyntax incompleteMemberSyntax:
                    return(IncompleteMember.Print(incompleteMemberSyntax));

                case InitializerExpressionSyntax initializerExpressionSyntax:
                    return(InitializerExpression.Print(initializerExpressionSyntax));

                case InterpolatedStringExpressionSyntax interpolatedStringExpressionSyntax:
                    return(InterpolatedStringExpression.Print(
                               interpolatedStringExpressionSyntax
                               ));

                case InterpolatedStringTextSyntax interpolatedStringTextSyntax:
                    return(InterpolatedStringText.Print(interpolatedStringTextSyntax));

                case InterpolationSyntax interpolationSyntax:
                    return(Interpolation.Print(interpolationSyntax));

                case InvocationExpressionSyntax invocationExpressionSyntax:
                    return(InvocationExpression.Print(invocationExpressionSyntax));

                case IsPatternExpressionSyntax isPatternExpressionSyntax:
                    return(IsPatternExpression.Print(isPatternExpressionSyntax));

                case JoinClauseSyntax joinClauseSyntax:
                    return(JoinClause.Print(joinClauseSyntax));

                case LabeledStatementSyntax labeledStatementSyntax:
                    return(LabeledStatement.Print(labeledStatementSyntax));

                case LetClauseSyntax letClauseSyntax:
                    return(LetClause.Print(letClauseSyntax));

                case LiteralExpressionSyntax literalExpressionSyntax:
                    return(LiteralExpression.Print(literalExpressionSyntax));

                case LocalDeclarationStatementSyntax localDeclarationStatementSyntax:
                    return(LocalDeclarationStatement.Print(localDeclarationStatementSyntax));

                case LocalFunctionStatementSyntax localFunctionStatementSyntax:
                    return(LocalFunctionStatement.Print(localFunctionStatementSyntax));

                case LockStatementSyntax lockStatementSyntax:
                    return(LockStatement.Print(lockStatementSyntax));

                case MakeRefExpressionSyntax makeRefExpressionSyntax:
                    return(MakeRefExpression.Print(makeRefExpressionSyntax));

                case MemberAccessExpressionSyntax memberAccessExpressionSyntax:
                    return(MemberAccessExpression.Print(memberAccessExpressionSyntax));

                case MemberBindingExpressionSyntax memberBindingExpressionSyntax:
                    return(MemberBindingExpression.Print(memberBindingExpressionSyntax));

                case NameColonSyntax nameColonSyntax:
                    return(NameColon.Print(nameColonSyntax));

                case NameEqualsSyntax nameEqualsSyntax:
                    return(NameEquals.Print(nameEqualsSyntax));

                case NamespaceDeclarationSyntax namespaceDeclarationSyntax:
                    return(NamespaceDeclaration.Print(namespaceDeclarationSyntax));

                case NullableTypeSyntax nullableTypeSyntax:
                    return(NullableType.Print(nullableTypeSyntax));

                case ObjectCreationExpressionSyntax objectCreationExpressionSyntax:
                    return(ObjectCreationExpression.Print(objectCreationExpressionSyntax));

                case OmittedArraySizeExpressionSyntax omittedArraySizeExpressionSyntax:
                    return(OmittedArraySizeExpression.Print(omittedArraySizeExpressionSyntax));

                case OmittedTypeArgumentSyntax omittedTypeArgumentSyntax:
                    return(OmittedTypeArgument.Print(omittedTypeArgumentSyntax));

                case OrderByClauseSyntax orderByClauseSyntax:
                    return(OrderByClause.Print(orderByClauseSyntax));

                case ParameterListSyntax parameterListSyntax:
                    return(ParameterList.Print(parameterListSyntax));

                case ParameterSyntax parameterSyntax:
                    return(Parameter.Print(parameterSyntax));

                case ParenthesizedExpressionSyntax parenthesizedExpressionSyntax:
                    return(ParenthesizedExpression.Print(parenthesizedExpressionSyntax));

                case ParenthesizedLambdaExpressionSyntax parenthesizedLambdaExpressionSyntax:
                    return(ParenthesizedLambdaExpression.Print(
                               parenthesizedLambdaExpressionSyntax
                               ));

                case ParenthesizedPatternSyntax parenthesizedPatternSyntax:
                    return(ParenthesizedPattern.Print(parenthesizedPatternSyntax));

                case ParenthesizedVariableDesignationSyntax parenthesizedVariableDesignationSyntax:
                    return(ParenthesizedVariableDesignation.Print(
                               parenthesizedVariableDesignationSyntax
                               ));

                case PointerTypeSyntax pointerTypeSyntax:
                    return(PointerType.Print(pointerTypeSyntax));

                case PostfixUnaryExpressionSyntax postfixUnaryExpressionSyntax:
                    return(PostfixUnaryExpression.Print(postfixUnaryExpressionSyntax));

                case PredefinedTypeSyntax predefinedTypeSyntax:
                    return(PredefinedType.Print(predefinedTypeSyntax));

                case PrefixUnaryExpressionSyntax prefixUnaryExpressionSyntax:
                    return(PrefixUnaryExpression.Print(prefixUnaryExpressionSyntax));

                case PrimaryConstructorBaseTypeSyntax primaryConstructorBaseTypeSyntax:
                    return(PrimaryConstructorBaseType.Print(primaryConstructorBaseTypeSyntax));

                case QualifiedNameSyntax qualifiedNameSyntax:
                    return(QualifiedName.Print(qualifiedNameSyntax));

                case QueryBodySyntax queryBodySyntax:
                    return(QueryBody.Print(queryBodySyntax));

                case QueryContinuationSyntax queryContinuationSyntax:
                    return(QueryContinuation.Print(queryContinuationSyntax));

                case QueryExpressionSyntax queryExpressionSyntax:
                    return(QueryExpression.Print(queryExpressionSyntax));

                case RangeExpressionSyntax rangeExpressionSyntax:
                    return(RangeExpression.Print(rangeExpressionSyntax));

                case RecursivePatternSyntax recursivePatternSyntax:
                    return(RecursivePattern.Print(recursivePatternSyntax));

                case RefExpressionSyntax refExpressionSyntax:
                    return(RefExpression.Print(refExpressionSyntax));

                case RefTypeExpressionSyntax refTypeExpressionSyntax:
                    return(RefTypeExpression.Print(refTypeExpressionSyntax));

                case RefTypeSyntax refTypeSyntax:
                    return(RefType.Print(refTypeSyntax));

                case RefValueExpressionSyntax refValueExpressionSyntax:
                    return(RefValueExpression.Print(refValueExpressionSyntax));

                case RelationalPatternSyntax relationalPatternSyntax:
                    return(RelationalPattern.Print(relationalPatternSyntax));

                case ReturnStatementSyntax returnStatementSyntax:
                    return(ReturnStatement.Print(returnStatementSyntax));

                case SelectClauseSyntax selectClauseSyntax:
                    return(SelectClause.Print(selectClauseSyntax));

                case SimpleBaseTypeSyntax simpleBaseTypeSyntax:
                    return(SimpleBaseType.Print(simpleBaseTypeSyntax));

                case SimpleLambdaExpressionSyntax simpleLambdaExpressionSyntax:
                    return(SimpleLambdaExpression.Print(simpleLambdaExpressionSyntax));

                case SingleVariableDesignationSyntax singleVariableDesignationSyntax:
                    return(SingleVariableDesignation.Print(singleVariableDesignationSyntax));

                case SizeOfExpressionSyntax sizeOfExpressionSyntax:
                    return(SizeOfExpression.Print(sizeOfExpressionSyntax));

                case StackAllocArrayCreationExpressionSyntax stackAllocArrayCreationExpressionSyntax:
                    return(StackAllocArrayCreationExpression.Print(
                               stackAllocArrayCreationExpressionSyntax
                               ));

                case SwitchExpressionSyntax switchExpressionSyntax:
                    return(SwitchExpression.Print(switchExpressionSyntax));

                case SwitchSectionSyntax switchSectionSyntax:
                    return(SwitchSection.Print(switchSectionSyntax));

                case SwitchStatementSyntax switchStatementSyntax:
                    return(SwitchStatement.Print(switchStatementSyntax));

                case ThisExpressionSyntax thisExpressionSyntax:
                    return(ThisExpression.Print(thisExpressionSyntax));

                case ThrowExpressionSyntax throwExpressionSyntax:
                    return(ThrowExpression.Print(throwExpressionSyntax));

                case ThrowStatementSyntax throwStatementSyntax:
                    return(ThrowStatement.Print(throwStatementSyntax));

                case TryStatementSyntax tryStatementSyntax:
                    return(TryStatement.Print(tryStatementSyntax));

                case TupleElementSyntax tupleElementSyntax:
                    return(TupleElement.Print(tupleElementSyntax));

                case TupleExpressionSyntax tupleExpressionSyntax:
                    return(TupleExpression.Print(tupleExpressionSyntax));

                case TupleTypeSyntax tupleTypeSyntax:
                    return(TupleType.Print(tupleTypeSyntax));

                case TypeArgumentListSyntax typeArgumentListSyntax:
                    return(TypeArgumentList.Print(typeArgumentListSyntax));

                case TypeConstraintSyntax typeConstraintSyntax:
                    return(TypeConstraint.Print(typeConstraintSyntax));

                case TypeOfExpressionSyntax typeOfExpressionSyntax:
                    return(TypeOfExpression.Print(typeOfExpressionSyntax));

                case TypeParameterConstraintClauseSyntax typeParameterConstraintClauseSyntax:
                    return(TypeParameterConstraintClause.Print(
                               typeParameterConstraintClauseSyntax
                               ));

                case TypeParameterListSyntax typeParameterListSyntax:
                    return(TypeParameterList.Print(typeParameterListSyntax));

                case TypeParameterSyntax typeParameterSyntax:
                    return(TypeParameter.Print(typeParameterSyntax));

                case TypePatternSyntax typePatternSyntax:
                    return(TypePattern.Print(typePatternSyntax));

                case UnaryPatternSyntax unaryPatternSyntax:
                    return(UnaryPattern.Print(unaryPatternSyntax));

                case UnsafeStatementSyntax unsafeStatementSyntax:
                    return(UnsafeStatement.Print(unsafeStatementSyntax));

                case UsingDirectiveSyntax usingDirectiveSyntax:
                    return(UsingDirective.Print(usingDirectiveSyntax));

                case UsingStatementSyntax usingStatementSyntax:
                    return(UsingStatement.Print(usingStatementSyntax));

                case VariableDeclarationSyntax variableDeclarationSyntax:
                    return(VariableDeclaration.Print(variableDeclarationSyntax));

                case VariableDeclaratorSyntax variableDeclaratorSyntax:
                    return(VariableDeclarator.Print(variableDeclaratorSyntax));

                case VarPatternSyntax varPatternSyntax:
                    return(VarPattern.Print(varPatternSyntax));

                case WhenClauseSyntax whenClauseSyntax:
                    return(WhenClause.Print(whenClauseSyntax));

                case WhereClauseSyntax whereClauseSyntax:
                    return(WhereClause.Print(whereClauseSyntax));

                case WhileStatementSyntax whileStatementSyntax:
                    return(WhileStatement.Print(whileStatementSyntax));

                case WithExpressionSyntax withExpressionSyntax:
                    return(WithExpression.Print(withExpressionSyntax));

                case YieldStatementSyntax yieldStatementSyntax:
                    return(YieldStatement.Print(yieldStatementSyntax));

                default:
                    throw new Exception("Can't handle " + syntaxNode.GetType().Name);
                }
            }

            finally
            {
                depth--;
            }
        }
 private bool IsMatch(UnsafeStatement left, UnsafeStatement data)
 {
     return(false);
 }
 /// <inheritdoc/>
 public virtual void VisitUnsafeStatement(UnsafeStatement syntax)
 {
     VisitNode(syntax);
 }
Exemplo n.º 17
0
 public override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     FixStatementIndentation(unsafeStatement.StartLocation);
     Console.WriteLine(unsafeStatement.Block);
     return(FixEmbeddedStatment(policy.StatementBraceStyle, BraceForcement.DoNotChange, unsafeStatement.Block));
 }
 public override void VisitUnsafeStatement(UnsafeStatement syntax)
 {
     _underlyingVisitor.VisitUnsafeStatement(syntax);
 }
Exemplo n.º 19
0
 public void VisitUnsafeStatement(UnsafeStatement node)
 {
     NotSupported(node);
 }
 public virtual void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(unsafeStatement);
     }
 }
 public object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 22
0
			public override object Visit(Unsafe unsafeStatement)
			{
				var result = new UnsafeStatement();
				result.AddChild(new CSharpTokenNode(Convert(unsafeStatement.loc), UnsafeStatement.UnsafeKeywordRole), UnsafeStatement.UnsafeKeywordRole);
				if (unsafeStatement.Block != null)
					result.AddChild((BlockStatement)unsafeStatement.Block.Accept(this), Roles.Body);
				return result;
			}
 public virtual S VisitUnsafeStatement(UnsafeStatement unsafeStatement, T data)
 {
     return(VisitChildren(unsafeStatement, data));
 }
Exemplo n.º 24
0
		public sealed override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			BeginVisit(unsafeStatement);
			object result = TrackedVisitUnsafeStatement(unsafeStatement, data);
			EndVisit(unsafeStatement);
			return result;
		}
Exemplo n.º 25
0
        public void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
        {
            JsonObject statement = CreateJsonStatement(unsafeStatement);

            AddKeyword(statement, UnsafeStatement.UnsafeKeywordRole);
            statement.AddJsonValue("body", GenStatement(unsafeStatement.Body));

            Push(statement);
            throw new FirstTimeUseException();
        }
Exemplo n.º 26
0
 public void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 27
0
		public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			Debug.Assert((unsafeStatement != null));
			Debug.Assert((unsafeStatement.Block != null));
			return unsafeStatement.Block.AcceptVisitor(this, data);
		}
Exemplo n.º 28
0
 public StringBuilder VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 29
0
 public Node VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     return(CreateDummy(unsafeStatement));
 }
Exemplo n.º 30
0
 public JNode VisitUnsafeStatement(UnsafeStatement node)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 31
0
 public virtual void Enter(UnsafeStatement unsafeStatement)
 {
 }
 public override void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
 {
     throw NotSupportedToConsistency();
 }
Exemplo n.º 33
0
 public virtual void Exit(UnsafeStatement unsafeStatement)
 {
 }
Exemplo n.º 34
0
 public StringBuilder VisitUnsafeStatement(UnsafeStatement unsafeStatement, int data)
 {
     throw new SLSharpException("SL# does not allow unsafe code.");
 }
Exemplo n.º 35
0
 public UnifiedElement VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     throw new NotImplementedException("UnsafeStatement");
 }
Exemplo n.º 36
0
        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
        {
            UnsafeStatement o = other as UnsafeStatement;

            return(o != null && this.Body.DoMatch(o.Body, match));
        }
Exemplo n.º 37
0
	void EmbeddedStatement(
#line  1528 "cs.ATG" 
out Statement statement) {

#line  1530 "cs.ATG" 
		TypeReference type = null;
		Expression expr = null;
		Statement embeddedStatement = null;
		statement = null;
		

#line  1536 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 16) {
			Block(
#line  1538 "cs.ATG" 
out statement);
		} else if (la.kind == 11) {
			lexer.NextToken();

#line  1541 "cs.ATG" 
			statement = new EmptyStatement(); 
		} else if (
#line  1544 "cs.ATG" 
UnCheckedAndLBrace()) {

#line  1544 "cs.ATG" 
			Statement block; bool isChecked = true; 
			if (la.kind == 58) {
				lexer.NextToken();
			} else if (la.kind == 118) {
				lexer.NextToken();

#line  1545 "cs.ATG" 
				isChecked = false;
			} else SynErr(197);
			Block(
#line  1546 "cs.ATG" 
out block);

#line  1546 "cs.ATG" 
			statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); 
		} else if (la.kind == 79) {
			IfStatement(
#line  1549 "cs.ATG" 
out statement);
		} else if (la.kind == 110) {
			lexer.NextToken();

#line  1551 "cs.ATG" 
			List<SwitchSection> switchSections = new List<SwitchSection>(); 
			Expect(20);
			Expr(
#line  1552 "cs.ATG" 
out expr);
			Expect(21);
			Expect(16);
			SwitchSections(
#line  1553 "cs.ATG" 
switchSections);
			Expect(17);

#line  1555 "cs.ATG" 
			statement = new SwitchStatement(expr, switchSections); 
		} else if (la.kind == 125) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1558 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1559 "cs.ATG" 
out embeddedStatement);

#line  1560 "cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
		} else if (la.kind == 65) {
			lexer.NextToken();
			EmbeddedStatement(
#line  1562 "cs.ATG" 
out embeddedStatement);
			Expect(125);
			Expect(20);
			Expr(
#line  1563 "cs.ATG" 
out expr);
			Expect(21);
			Expect(11);

#line  1564 "cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); 
		} else if (la.kind == 76) {
			lexer.NextToken();

#line  1566 "cs.ATG" 
			List<Statement> initializer = null; List<Statement> iterator = null; 
			Expect(20);
			if (StartOf(6)) {
				ForInitializer(
#line  1567 "cs.ATG" 
out initializer);
			}
			Expect(11);
			if (StartOf(6)) {
				Expr(
#line  1568 "cs.ATG" 
out expr);
			}
			Expect(11);
			if (StartOf(6)) {
				ForIterator(
#line  1569 "cs.ATG" 
out iterator);
			}
			Expect(21);
			EmbeddedStatement(
#line  1570 "cs.ATG" 
out embeddedStatement);

#line  1571 "cs.ATG" 
			statement = new ForStatement(initializer, expr, iterator, embeddedStatement); 
		} else if (la.kind == 77) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1573 "cs.ATG" 
out type);
			Identifier();

#line  1573 "cs.ATG" 
			string varName = t.val; 
			Expect(81);
			Expr(
#line  1574 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1575 "cs.ATG" 
out embeddedStatement);

#line  1576 "cs.ATG" 
			statement = new ForeachStatement(type, varName , expr, embeddedStatement); 
		} else if (la.kind == 53) {
			lexer.NextToken();
			Expect(11);

#line  1579 "cs.ATG" 
			statement = new BreakStatement(); 
		} else if (la.kind == 61) {
			lexer.NextToken();
			Expect(11);

#line  1580 "cs.ATG" 
			statement = new ContinueStatement(); 
		} else if (la.kind == 78) {
			GotoStatement(
#line  1581 "cs.ATG" 
out statement);
		} else if (
#line  1583 "cs.ATG" 
IsYieldStatement()) {
			Expect(132);
			if (la.kind == 101) {
				lexer.NextToken();
				Expr(
#line  1584 "cs.ATG" 
out expr);

#line  1584 "cs.ATG" 
				statement = new YieldStatement(new ReturnStatement(expr)); 
			} else if (la.kind == 53) {
				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;
		}
		
	}
Exemplo n.º 38
0
 public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     throw new global::System.NotImplementedException("UnsafeStatement");
 }
Exemplo n.º 39
0
		public virtual void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
		{
			DebugExpression(unsafeStatement);
			StartNode(unsafeStatement);
			WriteKeyword(UnsafeStatement.UnsafeKeywordRole);
			unsafeStatement.Body.AcceptVisitor(this);
			EndNode(unsafeStatement);
		}
Exemplo n.º 40
0
		public override void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
		{
			FixEmbeddedStatment(policy.StatementBraceStyle, BraceForcement.DoNotChange, unsafeStatement.Body);
		}
Exemplo n.º 41
0
 public object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     AddError(unsafeStatement, "UnsafeStatement is not supported.");
     return(null);
 }
Exemplo n.º 42
0
            // Yield statements use the default logic

            public override DefiniteAssignmentStatus VisitUnsafeStatement(UnsafeStatement unsafeStatement, DefiniteAssignmentStatus data)
            {
                return(data);
            }
Exemplo n.º 43
0
 private void Process_Unsafe_Statement(StringBuilder sb, UnsafeStatement statement)
 {
     sb.Append("unsafe");
     sb.Append(ProcessStatement(statement.Statement));
 }
Exemplo n.º 44
0
            public override ControlFlowNode VisitUnsafeStatement(UnsafeStatement unsafeStatement, ControlFlowNode data)
            {
                ControlFlowNode bodyEnd = HandleEmbeddedStatement(unsafeStatement.Body, data);

                return(CreateConnectedEndNode(unsafeStatement, bodyEnd));
            }
Exemplo n.º 45
0
 public override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     return(base.VisitUnsafeStatement(unsafeStatement, data));
 }
		public virtual void VisitUnsafeStatement (UnsafeStatement unsafeStatement)
		{
			VisitChildren (unsafeStatement);
		}
Exemplo n.º 47
0
 public virtual T Visit(UnsafeStatement unsafeStatement)
 {
     return(VisitChildren(unsafeStatement));
 }
Exemplo n.º 48
0
		public void VisitUnsafeStatement(UnsafeStatement unsafeStatement)
		{
			StartNode(unsafeStatement);
			WriteKeyword(UnsafeStatement.UnsafeKeywordRole);
			unsafeStatement.Body.AcceptVisitor(this);
			EndNode(unsafeStatement);
		}
Exemplo n.º 49
0
		public virtual object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			return base.VisitUnsafeStatement(unsafeStatement, data);
		}