public UnifiedElement VisitCatchClause(CatchClause catchClause, object data) { var type = LookupType(catchClause.Type); var name = UnifiedVariableIdentifier.Create(catchClause.VariableName); var body = catchClause.Body.TryAcceptForExpression(this).ToBlock(); return(UnifiedCatch.Create(type.ToSet(), name, body)); }
private static UnifiedCatch CreateResbody(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "resbody"); Contract.Requires(node.FirstElement().Name() == "array"); // TODO: UnifiedType.Create(ident) => identをUnifiedTypeIdentifierにべきでは? var children = node.FirstElement().Elements().ToList(); var block = CreateSmartBlock(node.LastElement()); if (children.Count == 0) { return(UnifiedCatch.Create( UnifiedSet <UnifiedType> .Create(), null, block)); } var assign = CreateExpresion(children.Last().FirstElement()); var types = children.SkipLast() .Select(CreateConst) .Select(UnifiedType.Create) .ToSet(); return(UnifiedCatch.Create(types, assign, block)); }