mt-lang 0.3.34 → 0.3.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/docs/index.html +5 -5
  4. data/docs/language-design.md +3 -3
  5. data/docs/language-manual.md +1 -1
  6. data/lib/milk_tea/base.rb +1 -1
  7. data/lib/milk_tea/bindings/bindgen/type_mapper.rb +12 -2
  8. data/lib/milk_tea/bindings/bindgen.rb +5 -0
  9. data/lib/milk_tea/core/c_backend/aggregate_utils.rb +4 -0
  10. data/lib/milk_tea/core/c_backend/expressions.rb +25 -3
  11. data/lib/milk_tea/core/c_backend/reinterpret.rb +2 -2
  12. data/lib/milk_tea/core/c_backend/runtime_helpers.rb +15 -2
  13. data/lib/milk_tea/core/c_backend/type_collectors.rb +39 -2
  14. data/lib/milk_tea/core/c_backend.rb +12 -0
  15. data/lib/milk_tea/core/compile_time.rb +109 -74
  16. data/lib/milk_tea/core/lexer.rb +12 -0
  17. data/lib/milk_tea/core/lowering/block.rb +6 -7
  18. data/lib/milk_tea/core/lowering/declarations.rb +40 -1
  19. data/lib/milk_tea/core/lowering/loops.rb +25 -1
  20. data/lib/milk_tea/core/lowering/resolve.rb +13 -6
  21. data/lib/milk_tea/core/lowering/utils.rb +6 -2
  22. data/lib/milk_tea/core/lowering.rb +12 -0
  23. data/lib/milk_tea/core/module_loader.rb +59 -37
  24. data/lib/milk_tea/core/parser/statements.rb +35 -7
  25. data/lib/milk_tea/core/parser.rb +12 -0
  26. data/lib/milk_tea/core/pretty_printer/ir_formatter.rb +4 -1
  27. data/lib/milk_tea/core/semantic_analyzer/attributes.rb +2 -1
  28. data/lib/milk_tea/core/semantic_analyzer/function_binding.rb +8 -20
  29. data/lib/milk_tea/core/semantic_analyzer/interface_conformance.rb +2 -1
  30. data/lib/milk_tea/core/semantic_analyzer/name_resolution.rb +12 -2
  31. data/lib/milk_tea/core/semantic_analyzer/statements.rb +10 -10
  32. data/lib/milk_tea/core/semantic_analyzer/top_level.rb +10 -12
  33. data/lib/milk_tea/core/semantic_analyzer/type_declaration.rb +14 -5
  34. data/lib/milk_tea/core/semantic_analyzer.rb +6 -31
  35. data/lib/milk_tea/lsp/server/code_actions.rb +12 -2
  36. data/lib/milk_tea/lsp/server/formatting.rb +172 -58
  37. data/lib/milk_tea/lsp/server/inlay_hints.rb +33 -11
  38. data/lib/milk_tea/lsp/server/selection_range.rb +4 -4
  39. data/lib/milk_tea/lsp/server/semantic_tokens.rb +9 -5
  40. data/lib/milk_tea/lsp/server/type_hierarchy.rb +5 -5
  41. data/lib/milk_tea/packages/manifest.rb +9 -0
  42. data/lib/milk_tea/tooling/linter/visitors.rb +4 -1
  43. data/std/box2d.mt +14 -14
  44. data/std/c/box2d.mt +19 -19
  45. metadata +3 -3
@@ -108,13 +108,11 @@ module MilkTea
108
108
  def collect_inferred_type_hints(facts, start_line, start_char, end_line, end_char)
109
109
  hints = []
110
110
  collect_local_decls(facts.ast).each do |decl|
111
+ next unless decl.name && decl.name != '_'
111
112
  next unless decl.type.nil?
112
113
  next unless position_in_range?(decl.line - 1, decl.column - 1, start_line, start_char, end_line, end_char)
113
114
 
114
- binding = facts.values[decl.name]
115
- next unless binding
116
-
117
- display_type = describe_type_for_hint(binding.storage_type)
115
+ display_type = resolved_decl_type_detail(decl, facts)
118
116
  next unless display_type
119
117
 
120
118
  hints << {
@@ -127,20 +125,30 @@ module MilkTea
127
125
  hints
128
126
  end
129
127
 
128
+ # Resolves the declared type of an inferred local from semantic facts so
129
+ # the hint reflects flow refinement (let/var ... else:, ?-propagation).
130
+ def resolved_decl_type_detail(decl, facts)
131
+ resolution = facts.respond_to?(:binding_resolution) ? facts.binding_resolution : nil
132
+ return nil unless resolution
133
+
134
+ binding_id = resolution.declaration_binding_ids[decl.object_id]
135
+ return nil unless binding_id
136
+
137
+ type = resolution.binding_types[binding_id]
138
+ return nil if type.is_a?(Types::Error)
139
+
140
+ short_type_detail(type)
141
+ end
142
+
130
143
  def collect_inferred_return_hints(facts, start_line, start_char, end_line, end_char)
131
144
  hints = []
132
145
  collect_function_defs(facts.ast).each do |func|
133
146
  next unless func.return_type.nil?
134
147
  next unless position_in_range?(func.line - 1, func.column - 1, start_line, start_char, end_line, end_char)
135
148
 
136
- binding = facts.functions[func.name]
137
- unless binding
138
- facts.imports.each_value do |mod|
139
- binding = mod.functions[func.name]
140
- break if binding
141
- end
142
- end
149
+ binding = resolve_function_binding(facts, func)
143
150
  next unless binding
151
+ next unless binding.respond_to?(:type) && binding.type.respond_to?(:return_type)
144
152
 
145
153
  return_type = binding.type.return_type
146
154
  next unless return_type
@@ -160,6 +168,20 @@ module MilkTea
160
168
  hints
161
169
  end
162
170
 
171
+ def resolve_function_binding(facts, func)
172
+ name = func.name
173
+ if func.is_a?(AST::MethodDef)
174
+ facts.methods.each_value do |methods|
175
+ binding = methods[name] || methods["static:#{name}"]
176
+ return binding if binding
177
+ end
178
+ return nil
179
+ end
180
+
181
+ facts.functions[name] ||
182
+ facts.imports.each_value.find { |mod| mod.functions.key?(name) }&.functions&.dig(name)
183
+ end
184
+
163
185
  def collect_local_decls(ast_node)
164
186
  results = []
165
187
  case ast_node
@@ -24,7 +24,7 @@ module MilkTea
24
24
  line_str = lines[lsp_line] || ""
25
25
  return nil if line_str.empty?
26
26
 
27
- token_range = token_bounds_at(line_str, lsp_char)
27
+ token_range = token_bounds_at(line_str, lsp_line, lsp_char)
28
28
  line_range = { start: { line: lsp_line, character: 0 },
29
29
  end: { line: lsp_line, character: line_str.length } }
30
30
 
@@ -47,7 +47,7 @@ module MilkTea
47
47
  current
48
48
  end
49
49
 
50
- def token_bounds_at(line_str, lsp_char)
50
+ def token_bounds_at(line_str, lsp_line, lsp_char)
51
51
  col = [lsp_char, line_str.length - 1].min
52
52
  col = [col, 0].max
53
53
 
@@ -61,8 +61,8 @@ module MilkTea
61
61
  return nil if left == right && line_str[left] !~ /[A-Za-z0-9_]/
62
62
 
63
63
  {
64
- start: { line: 0, character: left },
65
- end: { line: 0, character: right + 1 },
64
+ start: { line: lsp_line, character: left },
65
+ end: { line: lsp_line, character: right + 1 },
66
66
  }
67
67
  end
68
68
 
@@ -18,7 +18,7 @@ module MilkTea
18
18
  short_uri = shorten_uri(uri) || uri
19
19
  log_perf_breakdown('textDocument/semanticTokens/full', elapsed,
20
20
  "uri=#{short_uri} bytes=#{content.bytesize} lines=#{content.count("\n") + 1} cache=hit data_len=#{cached[:data].length}")
21
- return { data: cached[:data] }
21
+ return { resultId: cached[:result_id], data: cached[:data] }
22
22
  end
23
23
 
24
24
  tokens_start = monotonic_time
@@ -37,9 +37,8 @@ module MilkTea
37
37
  data = encode_semantic_tokens(semantic_entries)
38
38
  encode_ms = elapsed_ms(encode_start)
39
39
 
40
- @semantic_tokens_cache[uri] = { content_hash: cache_key, data: data }
41
-
42
40
  result_id = next_semantic_token_result_id(uri)
41
+ @semantic_tokens_cache[uri] = { content_hash: cache_key, data: data, result_id: result_id }
43
42
  @semantic_tokens_delta_cache[uri] = {
44
43
  result_id: result_id,
45
44
  content_hash: cache_key,
@@ -51,7 +50,7 @@ module MilkTea
51
50
  log_perf_breakdown('textDocument/semanticTokens/full', elapsed,
52
51
  "uri=#{short_uri} bytes=#{content.bytesize} lines=#{content.count("\n") + 1} cache=miss tokens=#{tokens.length} entries=#{semantic_entries.length} data_len=#{data.length} facts=on stages_ms=tokens:#{tokens_ms},facts:#{facts_ms},build:#{build_ms},encode:#{encode_ms}")
53
52
 
54
- { data: data }
53
+ { resultId: result_id, data: data }
55
54
  rescue StandardError => e
56
55
  warn "Error in semanticTokens/full handler: #{e.message}"
57
56
  { data: [] }
@@ -1745,7 +1744,12 @@ module MilkTea
1745
1744
 
1746
1745
  start_offset = prefix * 5
1747
1746
  delete_count = old_mid * 5
1748
- insert_tokens = encode_semantic_tokens(new_entries[prefix...(new_entries.length - suffix)])
1747
+
1748
+ # The inserted segment must keep the relative encoding against the
1749
+ # last unchanged token preceding the edit, so encode the full token
1750
+ # stream from the document origin and slice out the middle segment.
1751
+ full_encoded = encode_semantic_tokens(new_entries)
1752
+ insert_tokens = full_encoded[start_offset...(new_entries.length - suffix) * 5]
1749
1753
 
1750
1754
  [{ start: start_offset, deleteCount: delete_count, data: insert_tokens }]
1751
1755
  end
@@ -5,11 +5,11 @@ module MilkTea
5
5
  class Server
6
6
  module ServerTypeHierarchy
7
7
  TYPE_KIND_MAP = {
8
- struct: 22,
9
- enum: 13,
10
- flags: 13,
11
- variant: 13,
12
- union: 22,
8
+ struct: 23,
9
+ enum: 10,
10
+ flags: 10,
11
+ variant: 23,
12
+ union: 23,
13
13
  interface: 11,
14
14
  }.freeze
15
15
 
@@ -42,6 +42,15 @@ module MilkTea
42
42
  new(path).load
43
43
  end
44
44
 
45
+ # Best-effort manifest load for optional lookups: returns nil when no
46
+ # manifest applies to the path or when the manifest is invalid, instead
47
+ # of raising PackageManifestError.
48
+ def self.load_option(path)
49
+ load(path)
50
+ rescue PackageManifestError
51
+ nil
52
+ end
53
+
45
54
  def self.manifest_exists_for?(path)
46
55
  path = File.expand_path(path)
47
56
  current = File.directory?(path) ? path : File.dirname(path)
@@ -846,7 +846,10 @@ module MilkTea
846
846
  return false unless else_body
847
847
  text << else_body
848
848
 
849
- text.strip.length > 120
849
+ # The inline form would start at the `if` keyword's column, so the real
850
+ # line width includes the surrounding block's indentation.
851
+ indent = statement.branches.first.column.to_i - 1
852
+ (indent + text.strip.length) > 120
850
853
  end
851
854
 
852
855
  def source_line_from(line, column)
data/std/box2d.mt CHANGED
@@ -111,9 +111,9 @@ public const B2_PI: float = c.B2_PI
111
111
  public const B2_MAX_POLYGON_VERTICES: int = c.B2_MAX_POLYGON_VERTICES
112
112
  public const B2_DEFAULT_CATEGORY_BITS: int = c.B2_DEFAULT_CATEGORY_BITS
113
113
 
114
- public foreign function set_allocator(alloc_fcn: ptr[AllocFcn], free_fcn: ptr[FreeFcn]) -> void = c.b2SetAllocator
114
+ public foreign function set_allocator(alloc_fcn: AllocFcn, free_fcn: FreeFcn) -> void = c.b2SetAllocator
115
115
  public foreign function get_byte_count() -> int = c.b2GetByteCount
116
- public foreign function set_assert_fcn(assert_fcn: ptr[AssertFcn]) -> void = c.b2SetAssertFcn
116
+ public foreign function set_assert_fcn(assert_fcn: AssertFcn) -> void = c.b2SetAssertFcn
117
117
  public foreign function get_version() -> Version = c.b2GetVersion
118
118
  public foreign function internal_assert_fcn(condition: str as cstr, file_name: str as cstr, line_number: int) -> int = c.b2InternalAssertFcn
119
119
  public foreign function get_ticks() -> ulong = c.b2GetTicks
@@ -188,9 +188,9 @@ public foreign function dynamic_tree_move_proxy(tree: ptr[DynamicTree], proxy_id
188
188
  public foreign function dynamic_tree_enlarge_proxy(tree: ptr[DynamicTree], proxy_id: int, aabb: AABB) -> void = c.b2DynamicTree_EnlargeProxy
189
189
  public foreign function dynamic_tree_set_category_bits(tree: ptr[DynamicTree], proxy_id: int, category_bits: ptr_uint) -> void = c.b2DynamicTree_SetCategoryBits
190
190
  public foreign function dynamic_tree_get_category_bits(tree: ptr[DynamicTree], proxy_id: int) -> ulong = c.b2DynamicTree_GetCategoryBits
191
- public foreign function dynamic_tree_query(tree: const_ptr[DynamicTree], aabb: AABB, mask_bits: ptr_uint, callback: ptr[TreeQueryCallbackFcn], context: ptr[void]) -> TreeStats = c.b2DynamicTree_Query
192
- public foreign function dynamic_tree_ray_cast(tree: const_ptr[DynamicTree], input: const_ptr[RayCastInput], mask_bits: ptr_uint, callback: ptr[TreeRayCastCallbackFcn], context: ptr[void]) -> TreeStats = c.b2DynamicTree_RayCast
193
- public foreign function dynamic_tree_shape_cast(tree: const_ptr[DynamicTree], input: const_ptr[ShapeCastInput], mask_bits: ptr_uint, callback: ptr[TreeShapeCastCallbackFcn], context: ptr[void]) -> TreeStats = c.b2DynamicTree_ShapeCast
191
+ public foreign function dynamic_tree_query(tree: const_ptr[DynamicTree], aabb: AABB, mask_bits: ptr_uint, callback: TreeQueryCallbackFcn, context: ptr[void]) -> TreeStats = c.b2DynamicTree_Query
192
+ public foreign function dynamic_tree_ray_cast(tree: const_ptr[DynamicTree], input: const_ptr[RayCastInput], mask_bits: ptr_uint, callback: TreeRayCastCallbackFcn, context: ptr[void]) -> TreeStats = c.b2DynamicTree_RayCast
193
+ public foreign function dynamic_tree_shape_cast(tree: const_ptr[DynamicTree], input: const_ptr[ShapeCastInput], mask_bits: ptr_uint, callback: TreeShapeCastCallbackFcn, context: ptr[void]) -> TreeStats = c.b2DynamicTree_ShapeCast
194
194
  public foreign function dynamic_tree_get_height(tree: const_ptr[DynamicTree]) -> int = c.b2DynamicTree_GetHeight
195
195
  public foreign function dynamic_tree_get_area_ratio(tree: const_ptr[DynamicTree]) -> float = c.b2DynamicTree_GetAreaRatio
196
196
  public foreign function dynamic_tree_get_root_bounds(tree: const_ptr[DynamicTree]) -> AABB = c.b2DynamicTree_GetRootBounds
@@ -228,13 +228,13 @@ public foreign function world_draw(world_id: WorldId, inout draw: DebugDraw) ->
228
228
  public foreign function world_get_body_events(world_id: WorldId) -> BodyEvents = c.b2World_GetBodyEvents
229
229
  public foreign function world_get_sensor_events(world_id: WorldId) -> SensorEvents = c.b2World_GetSensorEvents
230
230
  public foreign function world_get_contact_events(world_id: WorldId) -> ContactEvents = c.b2World_GetContactEvents
231
- public foreign function world_overlap_aabb(world_id: WorldId, aabb: AABB, filter: QueryFilter, fcn: ptr[OverlapResultFcn], context: ptr[void]) -> TreeStats = c.b2World_OverlapAABB
232
- public foreign function world_overlap_shape(world_id: WorldId, proxy: const_ptr[ShapeProxy], filter: QueryFilter, fcn: ptr[OverlapResultFcn], context: ptr[void]) -> TreeStats = c.b2World_OverlapShape
233
- public foreign function world_cast_ray(world_id: WorldId, origin: Vec2, translation: Vec2, filter: QueryFilter, fcn: ptr[CastResultFcn], context: ptr[void]) -> TreeStats = c.b2World_CastRay
231
+ public foreign function world_overlap_aabb(world_id: WorldId, aabb: AABB, filter: QueryFilter, fcn: OverlapResultFcn, context: ptr[void]) -> TreeStats = c.b2World_OverlapAABB
232
+ public foreign function world_overlap_shape(world_id: WorldId, proxy: const_ptr[ShapeProxy], filter: QueryFilter, fcn: OverlapResultFcn, context: ptr[void]) -> TreeStats = c.b2World_OverlapShape
233
+ public foreign function world_cast_ray(world_id: WorldId, origin: Vec2, translation: Vec2, filter: QueryFilter, fcn: CastResultFcn, context: ptr[void]) -> TreeStats = c.b2World_CastRay
234
234
  public foreign function world_cast_ray_closest(world_id: WorldId, origin: Vec2, translation: Vec2, filter: QueryFilter) -> RayResult = c.b2World_CastRayClosest
235
- public foreign function world_cast_shape(world_id: WorldId, proxy: const_ptr[ShapeProxy], translation: Vec2, filter: QueryFilter, fcn: ptr[CastResultFcn], context: ptr[void]) -> TreeStats = c.b2World_CastShape
235
+ public foreign function world_cast_shape(world_id: WorldId, proxy: const_ptr[ShapeProxy], translation: Vec2, filter: QueryFilter, fcn: CastResultFcn, context: ptr[void]) -> TreeStats = c.b2World_CastShape
236
236
  public foreign function world_cast_mover(world_id: WorldId, mover: const_ptr[Capsule], translation: Vec2, filter: QueryFilter) -> float = c.b2World_CastMover
237
- public foreign function world_collide_mover(world_id: WorldId, mover: const_ptr[Capsule], filter: QueryFilter, fcn: ptr[PlaneResultFcn], context: ptr[void]) -> void = c.b2World_CollideMover
237
+ public foreign function world_collide_mover(world_id: WorldId, mover: const_ptr[Capsule], filter: QueryFilter, fcn: PlaneResultFcn, context: ptr[void]) -> void = c.b2World_CollideMover
238
238
  public foreign function world_enable_sleeping(world_id: WorldId, flag: bool) -> void = c.b2World_EnableSleeping
239
239
  public foreign function world_is_sleeping_enabled(world_id: WorldId) -> bool = c.b2World_IsSleepingEnabled
240
240
  public foreign function world_enable_continuous(world_id: WorldId, flag: bool) -> void = c.b2World_EnableContinuous
@@ -243,8 +243,8 @@ public foreign function world_set_restitution_threshold(world_id: WorldId, value
243
243
  public foreign function world_get_restitution_threshold(world_id: WorldId) -> float = c.b2World_GetRestitutionThreshold
244
244
  public foreign function world_set_hit_event_threshold(world_id: WorldId, value: float) -> void = c.b2World_SetHitEventThreshold
245
245
  public foreign function world_get_hit_event_threshold(world_id: WorldId) -> float = c.b2World_GetHitEventThreshold
246
- public foreign function world_set_custom_filter_callback(world_id: WorldId, fcn: ptr[CustomFilterFcn], context: ptr[void]) -> void = c.b2World_SetCustomFilterCallback
247
- public foreign function world_set_pre_solve_callback(world_id: WorldId, fcn: ptr[PreSolveFcn], context: ptr[void]) -> void = c.b2World_SetPreSolveCallback
246
+ public foreign function world_set_custom_filter_callback(world_id: WorldId, fcn: CustomFilterFcn, context: ptr[void]) -> void = c.b2World_SetCustomFilterCallback
247
+ public foreign function world_set_pre_solve_callback(world_id: WorldId, fcn: PreSolveFcn, context: ptr[void]) -> void = c.b2World_SetPreSolveCallback
248
248
  public foreign function world_set_gravity(world_id: WorldId, gravity: Vec2) -> void = c.b2World_SetGravity
249
249
  public foreign function world_get_gravity(world_id: WorldId) -> Vec2 = c.b2World_GetGravity
250
250
  public foreign function world_explode(world_id: WorldId, in explosion_def: ExplosionDef) -> void = c.b2World_Explode
@@ -258,8 +258,8 @@ public foreign function world_get_profile(world_id: WorldId) -> Profile = c.b2Wo
258
258
  public foreign function world_get_counters(world_id: WorldId) -> Counters = c.b2World_GetCounters
259
259
  public foreign function world_set_user_data(world_id: WorldId, user_data: ptr[void]) -> void = c.b2World_SetUserData
260
260
  public foreign function world_get_user_data(world_id: WorldId) -> ptr[void] = c.b2World_GetUserData
261
- public foreign function world_set_friction_callback(world_id: WorldId, callback: ptr[FrictionCallback]) -> void = c.b2World_SetFrictionCallback
262
- public foreign function world_set_restitution_callback(world_id: WorldId, callback: ptr[RestitutionCallback]) -> void = c.b2World_SetRestitutionCallback
261
+ public foreign function world_set_friction_callback(world_id: WorldId, callback: FrictionCallback) -> void = c.b2World_SetFrictionCallback
262
+ public foreign function world_set_restitution_callback(world_id: WorldId, callback: RestitutionCallback) -> void = c.b2World_SetRestitutionCallback
263
263
  public foreign function world_dump_memory_stats(world_id: WorldId) -> void = c.b2World_DumpMemoryStats
264
264
  public foreign function world_rebuild_static_tree(world_id: WorldId) -> void = c.b2World_RebuildStaticTree
265
265
  public foreign function world_enable_speculative(world_id: WorldId, flag: bool) -> void = c.b2World_EnableSpeculative
data/std/c/box2d.mt CHANGED
@@ -10,9 +10,9 @@ type b2AllocFcn = fn(arg0: uint, arg1: int) -> ptr[void]
10
10
  type b2FreeFcn = fn(arg0: ptr[void]) -> void
11
11
  type b2AssertFcn = fn(arg0: cstr, arg1: cstr, arg2: int) -> int
12
12
 
13
- external function b2SetAllocator(allocFcn: ptr[b2AllocFcn], freeFcn: ptr[b2FreeFcn]) -> void
13
+ external function b2SetAllocator(allocFcn: b2AllocFcn, freeFcn: b2FreeFcn) -> void
14
14
  external function b2GetByteCount() -> int
15
- external function b2SetAssertFcn(assertFcn: ptr[b2AssertFcn]) -> void
15
+ external function b2SetAssertFcn(assertFcn: b2AssertFcn) -> void
16
16
 
17
17
  struct b2Version:
18
18
  major: int
@@ -313,15 +313,15 @@ external function b2DynamicTree_GetCategoryBits(tree: ptr[b2DynamicTree], proxyI
313
313
 
314
314
  type b2TreeQueryCallbackFcn = fn(arg0: int, arg1: ulong, arg2: ptr[void]) -> bool
315
315
 
316
- external function b2DynamicTree_Query(tree: const_ptr[b2DynamicTree], aabb: b2AABB, maskBits: ptr_uint, callback: ptr[b2TreeQueryCallbackFcn], context: ptr[void]) -> b2TreeStats
316
+ external function b2DynamicTree_Query(tree: const_ptr[b2DynamicTree], aabb: b2AABB, maskBits: ptr_uint, callback: b2TreeQueryCallbackFcn, context: ptr[void]) -> b2TreeStats
317
317
 
318
318
  type b2TreeRayCastCallbackFcn = fn(arg0: const_ptr[b2RayCastInput], arg1: int, arg2: ulong, arg3: ptr[void]) -> float
319
319
 
320
- external function b2DynamicTree_RayCast(tree: const_ptr[b2DynamicTree], input: const_ptr[b2RayCastInput], maskBits: ptr_uint, callback: ptr[b2TreeRayCastCallbackFcn], context: ptr[void]) -> b2TreeStats
320
+ external function b2DynamicTree_RayCast(tree: const_ptr[b2DynamicTree], input: const_ptr[b2RayCastInput], maskBits: ptr_uint, callback: b2TreeRayCastCallbackFcn, context: ptr[void]) -> b2TreeStats
321
321
 
322
322
  type b2TreeShapeCastCallbackFcn = fn(arg0: const_ptr[b2ShapeCastInput], arg1: int, arg2: ulong, arg3: ptr[void]) -> float
323
323
 
324
- external function b2DynamicTree_ShapeCast(tree: const_ptr[b2DynamicTree], input: const_ptr[b2ShapeCastInput], maskBits: ptr_uint, callback: ptr[b2TreeShapeCastCallbackFcn], context: ptr[void]) -> b2TreeStats
324
+ external function b2DynamicTree_ShapeCast(tree: const_ptr[b2DynamicTree], input: const_ptr[b2ShapeCastInput], maskBits: ptr_uint, callback: b2TreeShapeCastCallbackFcn, context: ptr[void]) -> b2TreeStats
325
325
  external function b2DynamicTree_GetHeight(tree: const_ptr[b2DynamicTree]) -> int
326
326
  external function b2DynamicTree_GetAreaRatio(tree: const_ptr[b2DynamicTree]) -> float
327
327
  external function b2DynamicTree_GetRootBounds(tree: const_ptr[b2DynamicTree]) -> b2AABB
@@ -382,7 +382,7 @@ const b2_nullChainId: b2ChainId = b2ChainId(index1 = 0, world0 = 0, generation =
382
382
  const b2_nullJointId: b2JointId = b2JointId(index1 = 0, world0 = 0, generation = 0)
383
383
 
384
384
  type b2TaskCallback = fn(arg0: int, arg1: int, arg2: uint, arg3: ptr[void]) -> void
385
- type b2EnqueueTaskCallback = fn(arg0: ptr[b2TaskCallback], arg1: int, arg2: int, arg3: ptr[void], arg4: ptr[void]) -> ptr[void]
385
+ type b2EnqueueTaskCallback = fn(arg0: b2TaskCallback, arg1: int, arg2: int, arg3: ptr[void], arg4: ptr[void]) -> ptr[void]
386
386
  type b2FinishTaskCallback = fn(arg0: ptr[void], arg1: ptr[void]) -> void
387
387
  type b2FrictionCallback = fn(arg0: float, arg1: int, arg2: float, arg3: int) -> float
388
388
  type b2RestitutionCallback = fn(arg0: float, arg1: int, arg2: float, arg3: int) -> float
@@ -404,13 +404,13 @@ struct b2WorldDef:
404
404
  contactDampingRatio: float
405
405
  maxContactPushSpeed: float
406
406
  maximumLinearSpeed: float
407
- frictionCallback: ptr[b2FrictionCallback]
408
- restitutionCallback: ptr[b2RestitutionCallback]
407
+ frictionCallback: b2FrictionCallback
408
+ restitutionCallback: b2RestitutionCallback
409
409
  enableSleep: bool
410
410
  enableContinuous: bool
411
411
  workerCount: int
412
- enqueueTask: ptr[b2EnqueueTaskCallback]
413
- finishTask: ptr[b2FinishTaskCallback]
412
+ enqueueTask: b2EnqueueTaskCallback
413
+ finishTask: b2FinishTaskCallback
414
414
  userTaskContext: ptr[void]
415
415
  userData: ptr[void]
416
416
  internalValue: int
@@ -942,13 +942,13 @@ external function b2World_Draw(worldId: b2WorldId, draw: ptr[b2DebugDraw]) -> vo
942
942
  external function b2World_GetBodyEvents(worldId: b2WorldId) -> b2BodyEvents
943
943
  external function b2World_GetSensorEvents(worldId: b2WorldId) -> b2SensorEvents
944
944
  external function b2World_GetContactEvents(worldId: b2WorldId) -> b2ContactEvents
945
- external function b2World_OverlapAABB(worldId: b2WorldId, aabb: b2AABB, filter: b2QueryFilter, fcn: ptr[b2OverlapResultFcn], context: ptr[void]) -> b2TreeStats
946
- external function b2World_OverlapShape(worldId: b2WorldId, proxy: const_ptr[b2ShapeProxy], filter: b2QueryFilter, fcn: ptr[b2OverlapResultFcn], context: ptr[void]) -> b2TreeStats
947
- external function b2World_CastRay(worldId: b2WorldId, origin: b2Vec2, translation: b2Vec2, filter: b2QueryFilter, fcn: ptr[b2CastResultFcn], context: ptr[void]) -> b2TreeStats
945
+ external function b2World_OverlapAABB(worldId: b2WorldId, aabb: b2AABB, filter: b2QueryFilter, fcn: b2OverlapResultFcn, context: ptr[void]) -> b2TreeStats
946
+ external function b2World_OverlapShape(worldId: b2WorldId, proxy: const_ptr[b2ShapeProxy], filter: b2QueryFilter, fcn: b2OverlapResultFcn, context: ptr[void]) -> b2TreeStats
947
+ external function b2World_CastRay(worldId: b2WorldId, origin: b2Vec2, translation: b2Vec2, filter: b2QueryFilter, fcn: b2CastResultFcn, context: ptr[void]) -> b2TreeStats
948
948
  external function b2World_CastRayClosest(worldId: b2WorldId, origin: b2Vec2, translation: b2Vec2, filter: b2QueryFilter) -> b2RayResult
949
- external function b2World_CastShape(worldId: b2WorldId, proxy: const_ptr[b2ShapeProxy], translation: b2Vec2, filter: b2QueryFilter, fcn: ptr[b2CastResultFcn], context: ptr[void]) -> b2TreeStats
949
+ external function b2World_CastShape(worldId: b2WorldId, proxy: const_ptr[b2ShapeProxy], translation: b2Vec2, filter: b2QueryFilter, fcn: b2CastResultFcn, context: ptr[void]) -> b2TreeStats
950
950
  external function b2World_CastMover(worldId: b2WorldId, mover: const_ptr[b2Capsule], translation: b2Vec2, filter: b2QueryFilter) -> float
951
- external function b2World_CollideMover(worldId: b2WorldId, mover: const_ptr[b2Capsule], filter: b2QueryFilter, fcn: ptr[b2PlaneResultFcn], context: ptr[void]) -> void
951
+ external function b2World_CollideMover(worldId: b2WorldId, mover: const_ptr[b2Capsule], filter: b2QueryFilter, fcn: b2PlaneResultFcn, context: ptr[void]) -> void
952
952
  external function b2World_EnableSleeping(worldId: b2WorldId, flag: bool) -> void
953
953
  external function b2World_IsSleepingEnabled(worldId: b2WorldId) -> bool
954
954
  external function b2World_EnableContinuous(worldId: b2WorldId, flag: bool) -> void
@@ -957,8 +957,8 @@ external function b2World_SetRestitutionThreshold(worldId: b2WorldId, value: flo
957
957
  external function b2World_GetRestitutionThreshold(worldId: b2WorldId) -> float
958
958
  external function b2World_SetHitEventThreshold(worldId: b2WorldId, value: float) -> void
959
959
  external function b2World_GetHitEventThreshold(worldId: b2WorldId) -> float
960
- external function b2World_SetCustomFilterCallback(worldId: b2WorldId, fcn: ptr[b2CustomFilterFcn], context: ptr[void]) -> void
961
- external function b2World_SetPreSolveCallback(worldId: b2WorldId, fcn: ptr[b2PreSolveFcn], context: ptr[void]) -> void
960
+ external function b2World_SetCustomFilterCallback(worldId: b2WorldId, fcn: b2CustomFilterFcn, context: ptr[void]) -> void
961
+ external function b2World_SetPreSolveCallback(worldId: b2WorldId, fcn: b2PreSolveFcn, context: ptr[void]) -> void
962
962
  external function b2World_SetGravity(worldId: b2WorldId, gravity: b2Vec2) -> void
963
963
  external function b2World_GetGravity(worldId: b2WorldId) -> b2Vec2
964
964
  external function b2World_Explode(worldId: b2WorldId, explosionDef: const_ptr[b2ExplosionDef]) -> void
@@ -972,8 +972,8 @@ external function b2World_GetProfile(worldId: b2WorldId) -> b2Profile
972
972
  external function b2World_GetCounters(worldId: b2WorldId) -> b2Counters
973
973
  external function b2World_SetUserData(worldId: b2WorldId, userData: ptr[void]) -> void
974
974
  external function b2World_GetUserData(worldId: b2WorldId) -> ptr[void]
975
- external function b2World_SetFrictionCallback(worldId: b2WorldId, callback: ptr[b2FrictionCallback]) -> void
976
- external function b2World_SetRestitutionCallback(worldId: b2WorldId, callback: ptr[b2RestitutionCallback]) -> void
975
+ external function b2World_SetFrictionCallback(worldId: b2WorldId, callback: b2FrictionCallback) -> void
976
+ external function b2World_SetRestitutionCallback(worldId: b2WorldId, callback: b2RestitutionCallback) -> void
977
977
  external function b2World_DumpMemoryStats(worldId: b2WorldId) -> void
978
978
  external function b2World_RebuildStaticTree(worldId: b2WorldId) -> void
979
979
  external function b2World_EnableSpeculative(worldId: b2WorldId, flag: bool) -> void
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mt-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.34
4
+ version: 0.3.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Long (Teefan) Tran
@@ -624,7 +624,7 @@ metadata:
624
624
  homepage_uri: https://teefan.github.io/mt-lang/
625
625
  source_code_uri: https://github.com/teefan/mt-lang
626
626
  post_install_message: |
627
- Milk Tea 0.3.34 installed!
627
+ Milk Tea 0.3.38 installed!
628
628
 
629
629
  System requirements:
630
630
  - A C compiler (gcc or clang) must be available on PATH
@@ -646,7 +646,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
646
646
  - !ruby/object:Gem::Version
647
647
  version: '0'
648
648
  requirements: []
649
- rubygems_version: 4.0.6
649
+ rubygems_version: 4.0.18
650
650
  specification_version: 4
651
651
  summary: The Milk Tea programming language compiler toolchain
652
652
  test_files: []