public void TestLookup() { Table swiftTable = new Table(null, 0, null); BuiltinFunctionSymbol printSymbol = new BuiltinFunctionSymbol("print"); List<ParameterDeclaration> lst = new List<ParameterDeclaration>(); ParameterDeclaration par = new ParameterDeclaration(null, new Int64Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); swiftTable.Insert(printSymbol); Assert.IsNotNull(swiftTable.Lookup("print", new List<ASTType>() { new Int64Type() })); }
public abstract void visit(ParameterDeclaration n);
public static Table CreateBuiltinSymbols() { Table swiftTable = new Table(null, Global.Scope.BuiltinScope, "Builtin"); // print(string) BuiltinFunctionSymbol printSymbol = new BuiltinFunctionSymbol("print"); List<ParameterDeclaration> lst = new List<ParameterDeclaration>(); ParameterDeclaration par = new ParameterDeclaration(null, new StringType(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(int8) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new Int8Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(int16) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new Int16Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(int32) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new Int32Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(int64) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new Int64Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(uint8) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new UInt8Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(uint16) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new UInt16Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(uint32) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new UInt32Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); // print(uint64) printSymbol = new BuiltinFunctionSymbol("print"); lst = new List<ParameterDeclaration>(); par = new ParameterDeclaration(null, new UInt64Type(), null); lst.Add(par); printSymbol.Parameters = lst; printSymbol.ReturnValue = new TupleType(); printSymbol.OccupiedParamRegisters = 1; swiftTable.Insert(printSymbol); return swiftTable; }
public void visit(ParameterDeclaration n) { throw new NotImplementedException(); }
public override void visit(ParameterDeclaration n) { n.Scope = Scope; n.DefaultValue.accept(this); }