MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / aliases

Function aliases

cranelift/reader/src/parser.rs:3095–3119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3093
3094 #[test]
3095 fn aliases() {
3096 let (func, details) = Parser::new(
3097 "function %qux() system_v {
3098 block0:
3099 v4 = iconst.i8 6
3100 v3 -> v4
3101 v5 = iconst.i8 17
3102 v1 = iadd v3, v5
3103 }",
3104 )
3105 .parse_function()
3106 .unwrap();
3107 assert_eq!(func.name.to_string(), "%qux");
3108 let v4 = details.map.lookup_str("v4").unwrap();
3109 assert_eq!(v4.to_string(), "v4");
3110 let v3 = details.map.lookup_str("v3").unwrap();
3111 assert_eq!(v3.to_string(), "v3");
3112 match v3 {
3113 AnyEntity::Value(v3) => {
3114 let aliased_to = func.dfg.resolve_aliases(v3);
3115 assert_eq!(aliased_to.to_string(), "v4");
3116 }
3117 _ => panic!("expected value: {v3}"),
3118 }
3119 }
3120
3121 #[test]
3122 fn signature() {

Callers

nothing calls this directly

Calls 5

parse_functionMethod · 0.80
lookup_strMethod · 0.80
resolve_aliasesMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected