Changeset 2afec66 for src/tests/avltree
- Timestamp:
- Jul 26, 2017, 5:24:33 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 25bd9074
- Parents:
- 8a6cf7e
- Location:
- src/tests/avltree
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/avltree/avl.h
r8a6cf7e r2afec66 23 23 // forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p ); 24 24 25 forall(dtype T | { void ^?{}(T *); })25 forall(dtype T | { void ^?{}(T &); }) 26 26 void delete(T * x); 27 27 … … 59 59 60 60 forall(otype K | Comparable(K), otype V) 61 void ?{}(tree(K, V) *t, K key, V value);61 void ?{}(tree(K, V) &t, K key, V value); 62 62 63 63 forall(otype K, otype V) 64 void ^?{}(tree(K, V) *t);64 void ^?{}(tree(K, V) & t); 65 65 66 66 forall(otype K | Comparable(K), otype V) -
src/tests/avltree/avl1.c
r8a6cf7e r2afec66 3 3 4 4 forall(otype K | Comparable(K), otype V) 5 void ?{}(tree(K, V) *t, K key, V value){6 ( &t->key) { key };7 ( &t->value) { value };8 t ->parent = NULL;9 t ->left = NULL;10 t ->right = NULL;11 t ->balance = 0;5 void ?{}(tree(K, V) &t, K key, V value){ 6 (t.key) { key }; 7 (t.value) { value }; 8 t.parent = NULL; 9 t.left = NULL; 10 t.right = NULL; 11 t.balance = 0; 12 12 } 13 13 14 14 forall(otype K, otype V) 15 void ^?{}(tree(K, V) *t){16 delete(t ->left);17 delete(t ->right);18 ^( &t->key){};19 ^( &t->value){};15 void ^?{}(tree(K, V) & t){ 16 delete(t.left); 17 delete(t.right); 18 ^(t.key){}; 19 ^(t.value){}; 20 20 } 21 21 … … 24 24 // infinite loop trying to resolve ... t = malloc(); 25 25 tree(K, V) * t = malloc(sizeof(tree(K,V))); 26 t{ key, value };26 (*t){ key, value }; 27 27 return t; 28 28 }
Note: See TracChangeset
for help on using the changeset viewer.