js: fix wrong filename and invalid backend selected when using -o .js (#6777)
							parent
							
								
									2994e7150f
								
							
						
					
					
						commit
						af5836202c
					
				| 
						 | 
					@ -45,7 +45,11 @@ pub fn (mut b Builder) compile_js() {
 | 
				
			||||||
		println('all .v files:')
 | 
							println('all .v files:')
 | 
				
			||||||
		println(files)
 | 
							println(files)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	b.build_js(files, b.pref.out_name + '.js')
 | 
						mut name := b.pref.out_name
 | 
				
			||||||
 | 
						if !name.ends_with('.js') {
 | 
				
			||||||
 | 
							name += '.js'
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						b.build_js(files, name)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn (mut b Builder) run_js() {
 | 
					fn (mut b Builder) run_js() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -316,6 +316,9 @@ pub fn parse_args(args []string) (&Preferences, string) {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			'-o' {
 | 
								'-o' {
 | 
				
			||||||
				res.out_name = cmdline.option(current_args, '-o', '')
 | 
									res.out_name = cmdline.option(current_args, '-o', '')
 | 
				
			||||||
 | 
									if res.out_name.ends_with('.js') {
 | 
				
			||||||
 | 
										res.backend = .js
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				i++
 | 
									i++
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			'-b' {
 | 
								'-b' {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue