MODULE {DemoTrans} {demoSwf} {} INCLUDE "ByteCodeTrfBase.ag" WRAPPER SwfFile { demoSwf :: Options -> [SymbolTables] -> SwfFile -> SwfFile demoSwf opts tbls m = out where inh = Inh_SwfFile { opts_Inh_SwfFile = opts, tbls_Inh_SwfFile = tbls } sem = sem_SwfFile m syn = wrap_SwfFile sem inh out = output_Syn_SwfFile syn } -- Injects a trace method call if @lhs.method > 0 -- The higher-order child represents the decision. SEM Instruction | Virtual inst.mquery : QueryMethod inst.mquery = QueryMethod_Current inst.inj1 : InjRoot inst.inj1 = @loc.runInject $ when (@kind.self == VirtKind_EndBlock) $ do str <- declString ("method " ++ show @mquery.methodId ++ " block " ++ show @vid) l <- freshLabel pushGlobalObject getProp @nm.ref ifFalse l callWriteLog str label l inst.inj2 : InjRoot inst.inj2 = @loc.runInject $ when (@mquery.methodId == 3 && @kind.self == VirtKind_EndBody) $ do pushGlobalObject pushFalse setProp @nm.ref inst.inj3 : InjRoot inst.inj3 = @loc.runInject $ when (any (@mquery.methodId ==) [21,25] && @kind.self == VirtKind_BeginBody) $ do pushGlobalObject pushTrue setProp @nm.ref inst.inj4 : InjRoot inst.inj4 = @loc.runInject $ do trace (show @lhs.distCurrentParents) (return ()) return () -- parents <- currentParents -- parents <- return "hi" -- debug (show parents) -- Declare a name for a property "loggingupdated" SEM Instruction | Virtual inst.nm : DeclQName2 inst.nm = DeclQName2_Decl nm.name = "loggingupdated"