コード例 #1
0
ファイル: BuilderVisitor.cs プロジェクト: allisterb/peachpie
 private CatchBlock /*!*/ NewBlock(CatchItem item)
 {
     return(WithNewOrdinal(new CatchBlock(_binder.BindTypeRef(item.TargetType), _binder.BindCatchVariable(item))
     {
         PhpSyntax = item, Naming = _naming
     }));
 }
コード例 #2
0
ファイル: BuilderVisitor.cs プロジェクト: ruo2012/peachpie
 private CatchBlock /*!*/ NewBlock(CatchItem item)
 {
     return(WithNewOrdinal(new CatchBlock(item.TypeRef, _binder.BindCatchVariable(item))
     {
         PhpSyntax = item
     }));
 }
コード例 #3
0
 public override void VisitCatchItem(CatchItem x)
 {
     using (new ScopeHelper(this, x))
     {
         base.VisitCatchItem(x);
     }
 }
コード例 #4
0
 override public void VisitCatchItem(CatchItem x)
 {
     _serializer.StartSerialize(typeof(CatchItem).Name, SerializeSpan(x.Span));
     SerializeOptionalProperty("TypeRef", x.TargetType);
     SerializeOptionalProperty("Variable", x.Variable);
     SerializeOptionalProperty("Body", x.Body);
     _serializer.EndSerialize();
 }
コード例 #5
0
 private static CatchExpression ToCatchExpression(CatchItem e)
 {
     return(new CatchExpression(
                Parse(e.Body),
                ToVariableExpression(e.Variable),
                FromTypeRef(e.TargetType)
                ));
 }
コード例 #6
0
ファイル: TokenVisitor.cs プロジェクト: petrroll/Parsers
 public override void VisitCatchItem(CatchItem x)
 {
     // catch (TYPE VARIABLE) BLOCK
     using (new ScopeHelper(this, x))
     {
         ConsumeToken(Tokens.T_CATCH, "catch");
         ConsumeToken(Tokens.T_LPAREN, "(");
         VisitElement(x.TargetType);
         VisitElement(x.Variable);
         ConsumeToken(Tokens.T_RPAREN, ")");
         VisitElement(x.Body);
     }
 }
コード例 #7
0
            public void Analyze(CatchItem /*!*/ node, Analyzer /*!*/ analyzer)
            {
                ExInfoFromParent info = new ExInfoFromParent(node);

                info.Access = AccessType.Write;

                resolvedType = analyzer.ResolveTypeName(node.ClassName, analyzer.CurrentType, analyzer.CurrentRoutine, node.Span, false);

                node.Variable.Analyze(analyzer, info);

                analyzer.EnterConditionalCode();
                node.Statements.Analyze(analyzer);
                analyzer.LeaveConditionalCode();
            }
コード例 #8
0
ファイル: PlayerScript.cs プロジェクト: StamplerJ/FaithGame
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (!isActive)
        {
            return;
        }

        if (other.tag.Equals("CatchItem"))
        {
            CatchItem item = other.GetComponent <CatchItem>();
            UpdateFaith(item.faith);
            UpdateCollected();
            Destroy(other.gameObject);
        }
    }
コード例 #9
0
        private TryStmt /*!*/ CreateTryStmt(Position pos, List <Statement> /*!*/ tryStmts, Position classNamePos,
                                            GenericQualifiedName /*!*/ className, Position variablePos, string /*!*/ variable,
                                            List <Statement> /*!*/ catchStmts, List <CatchItem> catches)
        {
            CatchItem catch_item = new CatchItem(classNamePos, className, new DirectVarUse(variablePos,
                                                                                           new VariableName(variable)), catchStmts);

            if (catches != null)
            {
                catches.Insert(0, catch_item);
            }
            else
            {
                catches = new List <CatchItem>();
                catches.Add(catch_item);
            }

            return(new TryStmt(pos, tryStmts, catches));
        }
コード例 #10
0
            /// <summary>
            /// Emits the catch-block.
            /// </summary>
            /// <param name="node">Instance.</param>
            /// <param name="codeGenerator">A code generator.</param>
            /// <param name="exceptionLocal">A local variable containing an instance of <see cref="Library.SPL.Exception"/>.</param>
            /// <param name="endLabel">A label in IL stream where the processing of the try-catch blocks ends.</param>
            /// <param name="nextCatchLabel">A label in IL stream where the next catch block processing begins.</param>
            public void Emit(CatchItem /*!*/ node, CodeGenerator /*!*/ codeGenerator,
                             LocalBuilder /*!*/ exceptionLocal,
                             Label endLabel, Label nextCatchLabel)
            {
                ILEmitter il = codeGenerator.IL;

                codeGenerator.MarkSequencePoint(node.Variable);

                // IF !InstanceOf(<class name>) GOTO next_catch;
                il.Ldloc(exceptionLocal);
                resolvedType.EmitInstanceOf(codeGenerator, null);
                il.Emit(OpCodes.Brfalse, nextCatchLabel);

                // variable = exception;
                node.Variable.Emit(codeGenerator);
                il.Ldloc(exceptionLocal);
                SimpleVarUseHelper.EmitAssign(node.Variable, codeGenerator);

                node.Statements.Emit(codeGenerator);

                // LEAVE end;
                il.Emit(OpCodes.Leave, endLabel);
            }
コード例 #11
0
 /// <summary>
 /// Visit catch. Variable first then body statements.
 /// </summary>
 /// <param name="x"></param>
 virtual public void VisitCatchItem(CatchItem x)
 {
     VisitElement(x.TargetType);
     VisitElement(x.Variable);
     VisitElement(x.Body);
 }
コード例 #12
0
 public static void Emit(this CatchItem /*!*/ node, CodeGenerator /*!*/ codeGenerator, LocalBuilder /*!*/ exceptionLocal, Label endLabel, Label nextCatchLabel)
 {
     node.NodeCompiler <ICatchItemCompiler>().Emit(node, codeGenerator, exceptionLocal, endLabel, nextCatchLabel);
 }
コード例 #13
0
 public static void Analyze(this CatchItem /*!*/ node, Analyzer /*!*/ analyzer)
 {
     node.NodeCompiler <ICatchItemCompiler>().Analyze(node, analyzer);
 }