public Function(Identifier returnType, Identifier name, Sequence<Parameter> pars, Sequence<Statement> stmts) { Type[] tar = Parameter.ConvertSequenceToTypeArray(pars); var mb = CodeGenerator.CreateFunction(name.Value, TypeChecker.ConvertStringToType(returnType.Value), tar); mi = mb; this.stmts = stmts; if (fns.ContainsKey(name.Value)) { throw new Exception("Function redeclared. Note: overloaded functions are not supported at this time."); } fns.Add(name.Value, this); int count = 1; //parameters start at index 1 - 0 is the return. not sure on GetParameters() though - more testing is needed, but i don't think it includes the returntype as there is a separate way to get that foreach (Parameter p in pars) { mb.DefineParameter(count++, ParameterAttributes.None, p.Name); } ec = new ExecutionContext(null); ec.SetParameters(pars.ToArray()); }
public Parameter(Identifier type, Identifier name) { this.type = TypeChecker.ConvertStringToType(type.Value); this.name = name.Value; }
public FunctionCall(Identifier funcName, Sequence<Expression> alist) { this.funcName = funcName.Value; this.alist = alist; }
public Function(Identifier returnType, Identifier name, Sequence<Statement> stmts) : this(returnType, name, new Sequence<Parameter>(), stmts) { }
public CallStatement(Identifier funcName) { this.fc = new FunctionCall(funcName, new Sequence<Expression>()); }
public AssignmentStatement(Identifier varName, Expression e) { this.e = e; this.varName = varName.Value; }