breaking,checker: disallow initializing private struct fields outside structs module (#21183)

This commit is contained in:
Turiiya 2024-04-12 12:53:02 +02:00 committed by GitHub
parent a8d0cdd31b
commit 1a35a783f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
96 changed files with 225 additions and 111 deletions

View file

@ -11,6 +11,7 @@ const max_parallel_workers = runtime.nr_jobs()
@[params]
pub struct ParserSettings {
pub:
sequential bool
img bool
extra_workers int

View file

@ -11,6 +11,7 @@ pub const default_gravity = 4.9
@[params]
pub struct SimParams {
pub:
rope_length f64 = sim.default_rope_length
bearing_mass f64 = sim.default_bearing_mass
magnet_spacing f64 = sim.default_magnet_spacing

View file

@ -1,7 +1,7 @@
module sim
pub struct SimState {
mut:
pub mut:
position Vector3D
velocity Vector3D
accel Vector3D

View file

@ -4,6 +4,7 @@ import math
// Vector3D is a 3D vector
pub struct Vector3D {
pub:
x f64
y f64
z f64

View file

@ -7,10 +7,10 @@ const max_iterations = 1000
const simulation_delta_t = 0.0005
pub struct SimRequest {
pub:
params SimParams
state SimState
pub:
id int
id int
}
pub struct SimResult {

View file

@ -27,7 +27,7 @@ fn remap(v f64, min f64, max f64, new_min f64, new_max f64) f64 {
// Particle
pub struct Particle {
mut:
pub mut:
location vec.Vec2[f64]
velocity vec.Vec2[f64]
acceleration vec.Vec2[f64]

View file

@ -7,10 +7,12 @@ import rand
import sokol.sgl
pub struct SystemConfig {
pub:
pool int
}
pub struct System {
pub:
width int
height int
mut:

View file

@ -40,11 +40,9 @@ fn new_app() !&App {
}
fn new_websocker_server() !&websocket.Server {
mut wss := &websocket.Server{
logger: &log.Log{
level: .debug
}
}
mut logger := &log.Log{}
logger.set_level(.debug)
mut wss := websocket.new_server(.ip, 8080, '', logger: logger)
wss.on_connect(fn (mut server_client websocket.ServerClient) !bool {
slog('ws.on_connect, server_client.client_key: ${server_client.client_key}')
return true