Fix to cache correct PathToNode in artifact graph (#6632)
* Add NodePath to artifact graph Since this is cached, this should make PathToNode computation correct even when code is formatted, whitespace changes, and source ranges are different. * Remove dead code * Add unit tests * Add tests for PathToNode conversion * Remove unused parameter * Add missing PathToNode cases * Fix to handle unlabeled arg * Cherry pick unlabeled arg fix * Change PathToNode comment to match TS implementation
This commit is contained in:
		
							
								
								
									
										22
									
								
								rust/kcl-lib/tests/misc/cube.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								rust/kcl-lib/tests/misc/cube.kcl
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
@settings(defaultLengthUnit = mm)
 | 
			
		||||
 | 
			
		||||
fn cube(sideLength, center) {
 | 
			
		||||
  l = sideLength / 2
 | 
			
		||||
  x = center[0]
 | 
			
		||||
  y = center[1]
 | 
			
		||||
  p0 = [-l + x, -l + y]
 | 
			
		||||
  p1 = [-l + x, l + y]
 | 
			
		||||
  p2 = [l + x, l + y]
 | 
			
		||||
  p3 = [l + x, -l + y]
 | 
			
		||||
 | 
			
		||||
  return startSketchOn(XY)
 | 
			
		||||
    |> startProfile(at = p0)
 | 
			
		||||
    |> line(endAbsolute = p1)
 | 
			
		||||
    |> line(endAbsolute = p2)
 | 
			
		||||
    |> line(endAbsolute = p3)
 | 
			
		||||
    |> line(endAbsolute = p0)
 | 
			
		||||
    |> close()
 | 
			
		||||
    |> extrude(length = sideLength)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
myCube = cube(sideLength = 40, center = [0, 0])
 | 
			
		||||
		Reference in New Issue
	
	Block a user