The template part of the new syntax! Gotta go transform all of stdlib and the tests now and see if any other bugs pop up
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
#include "test_negative_number_unary.krak.h"
|
||||
|
||||
/**
|
||||
* Variable Declarations
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function Definitions
|
||||
*/
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
/**
|
||||
* Plain Typedefs
|
||||
*/
|
||||
|
||||
/**
|
||||
* Import Includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Top Level C Passthrough
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extern Variable Declarations
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Structs
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function Prototypes
|
||||
*/
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
cc -std=c99 test_negative_number_unary.krak.c -o test_negative_number_unary.krak
|
||||
@@ -18,5 +18,3 @@ fun main() : int {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
3
tests/test_newSyntaxTemplate.expected_results
Normal file
3
tests/test_newSyntaxTemplate.expected_results
Normal file
@@ -0,0 +1,3 @@
|
||||
yeah new syntax: 7, 6
|
||||
yeah new syntax: 6, 7
|
||||
yeah new syntax: 7, 6
|
||||
36
tests/test_newSyntaxTemplate.krak
Normal file
36
tests/test_newSyntaxTemplate.krak
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
typedef Swapper<T> {
|
||||
fun doit(a: T*, b: T*) : void {
|
||||
var temp: T = *a;
|
||||
*a = *b;
|
||||
*b = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun swap<T>(a: T*, b: T*) : void {
|
||||
var temp: T = *a
|
||||
*a = *b
|
||||
*b = temp;
|
||||
}
|
||||
|
||||
fun print2int(a: int, b: int) : void {
|
||||
simple_passthrough(a = a, b = b::) """
|
||||
printf("yeah new syntax: %d, %d\n", a, b);
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
fun main() : int {
|
||||
var i: int = 7;
|
||||
var j: int = 6;
|
||||
print2int(i,j)
|
||||
swap<int>(&i, &j)
|
||||
print2int(i,j)
|
||||
var it: Swapper<int>
|
||||
it.doit(&i,&j);
|
||||
print2int(i,j)
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user