public static ParameterBase[] GetParameters(ParsingData parser, ParameterDefineNode[] defineNodes) { ParameterBase[] parameters = new ParameterBase[defineNodes.Length]; for (int i = 0; i < parameters.Length; i++) { EnumData enumData = null; DefinedType type = null; if (defineNodes[i].Type != null) { enumData = EnumData.GetEnum(defineNodes[i].Type); type = parser.GetDefinedType(defineNodes[i].Type, null); if (enumData == null && type == null) { throw SyntaxErrorException.NonexistentType(defineNodes[i].Type, defineNodes[i].Location); } } if (enumData != null) { parameters[i] = new EnumParameter(defineNodes[i].VariableName, enumData.Type); } else if (type != null) { parameters[i] = new TypeParameter(defineNodes[i].VariableName, type); } else { parameters[i] = new Parameter(defineNodes[i].VariableName, Elements.ValueType.Any, null); } } return(parameters); }
public DefinedType GetDefinedType(string name, Location location) { DefinedType type = DefinedTypes.FirstOrDefault(dt => dt.Name == name); if (type == null && location != null) { throw SyntaxErrorException.NonexistentType(name, location); } return(type); }