stevedlawrence commented on a change in pull request #207: Added support for enumerations and TypeValueCalc URL: https://github.com/apache/incubator-daffodil/pull/207#discussion_r278202422
########## File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DFDLXTypeCalcFunctions.scala ########## @@ -0,0 +1,239 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.daffodil.dpath + +import org.apache.daffodil.xml.QName +import org.apache.daffodil.util.Maybe +import org.apache.daffodil.processors.TypeCalculator +import org.apache.daffodil.processors.SimpleTypeRuntimeData +import org.apache.daffodil.exceptions.Assert +import org.apache.daffodil.dpath.NodeInfo.PrimType.IntegerKind +import org.apache.daffodil.dpath.NodeInfo.PrimType.String +import org.apache.daffodil.dpath.NodeInfo.PrimType.Integer + +trait typeCalculatorNamedDispatch { self: FNTwoArgs => + var srcType: NodeInfo.Kind = null + var dstType: NodeInfo.Kind = null + + override def validateType(srcTypes: Seq[NodeInfo.Kind], dstType: NodeInfo.Kind): Unit = { + //We can't actually verify anything yet, because we need to wait until run() is + //called to know what calculator we are using Review comment: I'm not sure I understand this. What information is only available at runtime that is needed to validate the types? Seems like maybe you could create a custom Expr (instead of FNTwoArgExpr) that can do all the necessary validation at schema compile time? The function name is also a little confusing. This function only exists in two places and neither one does actual vlaidation. Maybe a different name would make more sense to make it clear it's just setting types related to the function? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
