private CatchBlock /*!*/ NewBlock(CatchItem item) { return(WithNewOrdinal(new CatchBlock(_binder.BindTypeRef(item.TargetType), _binder.BindCatchVariable(item)) { PhpSyntax = item, Naming = _naming })); }
private CatchBlock /*!*/ NewBlock(CatchItem item) { return(WithNewOrdinal(new CatchBlock(item.TypeRef, _binder.BindCatchVariable(item)) { PhpSyntax = item })); }
public override void VisitCatchItem(CatchItem x) { using (new ScopeHelper(this, x)) { base.VisitCatchItem(x); } }
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(); }
private static CatchExpression ToCatchExpression(CatchItem e) { return(new CatchExpression( Parse(e.Body), ToVariableExpression(e.Variable), FromTypeRef(e.TargetType) )); }
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); } }
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(); }
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); } }
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)); }
/// <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); }
/// <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); }
public static void Emit(this CatchItem /*!*/ node, CodeGenerator /*!*/ codeGenerator, LocalBuilder /*!*/ exceptionLocal, Label endLabel, Label nextCatchLabel) { node.NodeCompiler <ICatchItemCompiler>().Emit(node, codeGenerator, exceptionLocal, endLabel, nextCatchLabel); }
public static void Analyze(this CatchItem /*!*/ node, Analyzer /*!*/ analyzer) { node.NodeCompiler <ICatchItemCompiler>().Analyze(node, analyzer); }