make private struct warning an error
							parent
							
								
									e159347c10
								
							
						
					
					
						commit
						4c7df98ac9
					
				|  | @ -6,7 +6,7 @@ const ( | ||||||
| 	port = 8082 | 	port = 8082 | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| struct App { | pub struct App { | ||||||
| pub mut: | pub mut: | ||||||
| 	vweb vweb.Context // TODO embed
 | 	vweb vweb.Context // TODO embed
 | ||||||
| 	cnt int | 	cnt int | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ mut: | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // webhook server
 | // webhook server
 | ||||||
| struct WebhookServer { | pub struct WebhookServer { | ||||||
| pub mut: | pub mut: | ||||||
| 	vweb   vweb.Context | 	vweb   vweb.Context | ||||||
| 	gen_vc &GenVC | 	gen_vc &GenVC | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ module builtin | ||||||
| 
 | 
 | ||||||
| import strings | import strings | ||||||
| 
 | 
 | ||||||
| struct array { | pub struct array { | ||||||
| pub: | pub: | ||||||
| // Using a void pointer allows to implement arrays without generics and without generating
 | // Using a void pointer allows to implement arrays without generics and without generating
 | ||||||
| // extra code for every type.
 | // extra code for every type.
 | ||||||
|  |  | ||||||
|  | @ -869,7 +869,7 @@ pub fn (s string) ustring() ustring { | ||||||
| 		s: s | 		s: s | ||||||
| 		// runes will have at least s.len elements, save reallocations
 | 		// runes will have at least s.len elements, save reallocations
 | ||||||
| 		// TODO use VLA for small strings?
 | 		// TODO use VLA for small strings?
 | ||||||
| 		 | 
 | ||||||
| 		runes: new_array(0, s.len, sizeof(int)) | 		runes: new_array(0, s.len, sizeof(int)) | ||||||
| 	} | 	} | ||||||
| 	for i := 0; i < s.len; i++ { | 	for i := 0; i < s.len; i++ { | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ fn (p mut Parser) get_type2() Type { | ||||||
| 		// Register anon fn type
 | 		// Register anon fn type
 | ||||||
| 		fn_typ := Type{ | 		fn_typ := Type{ | ||||||
| 			name: f.typ_str() // 'fn (int, int) string'
 | 			name: f.typ_str() // 'fn (int, int) string'
 | ||||||
| 			 | 
 | ||||||
| 			mod: p.mod | 			mod: p.mod | ||||||
| 			func: f | 			func: f | ||||||
| 			cat: .func | 			cat: .func | ||||||
|  |  | ||||||
|  | @ -342,7 +342,7 @@ fn (p mut Parser) struct_init(typ_ string) string { | ||||||
| 	mut typ := typ_ | 	mut typ := typ_ | ||||||
| 	mut t := p.table.find_type(typ) | 	mut t := p.table.find_type(typ) | ||||||
| 	if !t.is_public && t.mod != p.mod { | 	if !t.is_public && t.mod != p.mod { | ||||||
| 		p.warn('type `$t.name` is private') | 		p.error('struct `$t.name` is private') | ||||||
| 	} | 	} | ||||||
| 	// generic struct init
 | 	// generic struct init
 | ||||||
| 	if p.peek() == .lt { | 	if p.peek() == .lt { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue