public ILBlockTranslator(AssemblyTranslator translator, DecompilerContext context, MethodReference methodReference, MethodDefinition methodDefinition, ILBlock ilb, IEnumerable<ILVariable> parameters, IEnumerable<ILVariable> allVariables) { Translator = translator; Context = context; ThisMethodReference = methodReference; ThisMethod = methodDefinition; Block = ilb; JS = new JSSpecialIdentifiers(TypeSystem); JSIL = new JSILIdentifier(TypeSystem, JS); CLR = new CLRSpecialIdentifiers(TypeSystem); if (methodReference.HasThis) Variables.Add("this", JSThisParameter.New(methodReference.DeclaringType)); foreach (var parameter in parameters) { if ((parameter.Name == "this") && (parameter.OriginalParameter.Index == -1)) continue; ParameterNames.Add(parameter.Name); Variables.Add(parameter.Name, new JSParameter(parameter.Name, parameter.Type)); } foreach (var variable in allVariables) { var v = JSVariable.New(variable); if (Variables.ContainsKey(v.Identifier)) { v = new JSVariable(variable.OriginalVariable.Name, variable.Type); RenamedVariables[variable] = v; Variables.Add(v.Identifier, v); } else { Variables.Add(v.Identifier, v); } } }
public SpecialIdentifiers(MethodTypeFactory methodTypes, TypeSystem typeSystem, ITypeInfoSource typeInfo) { TypeSystem = typeSystem; JS = new JSSpecialIdentifiers(methodTypes, typeSystem); CLR = new CLRSpecialIdentifiers(typeSystem); JSIL = new JSILIdentifier(methodTypes, typeSystem, typeInfo, JS); }
public JSILIdentifier(TypeSystem typeSystem, JSSpecialIdentifiers js) { TypeSystem = typeSystem; JS = js; GlobalNamespace = Dot("GlobalNamespace", TypeSystem.Object); CopyMembers = Dot("CopyMembers", TypeSystem.Void); }
public JSILIdentifier(MethodTypeFactory methodTypes, TypeSystem typeSystem, JSSpecialIdentifiers js) { TypeSystem = typeSystem; MethodTypes = methodTypes; JS = js; GlobalNamespace = Dot("GlobalNamespace", TypeSystem.Object); CopyMembers = Dot("CopyMembers", TypeSystem.Void); }
public SpecialIdentifiers(MethodTypeFactory methodTypes, TypeSystem typeSystem) { TypeSystem = typeSystem; JS = new JSSpecialIdentifiers(methodTypes, typeSystem); CLR = new CLRSpecialIdentifiers(typeSystem); JSIL = new JSILIdentifier(methodTypes, typeSystem, JS); }
public SpecialIdentifiers(TypeSystem typeSystem) { TypeSystem = typeSystem; JS = new JSSpecialIdentifiers(typeSystem); CLR = new CLRSpecialIdentifiers(typeSystem); JSIL = new JSILIdentifier(typeSystem, JS); }
protected void TranslateModule(DecompilerContext context, JavascriptFormatter output, ModuleDefinition module, List<Action> initializer, HashSet<TypeDefinition> sealedTypes, bool stubbed) { var moduleInfo = TypeInfoProvider.GetModuleInformation(module); if (moduleInfo.IsIgnored) return; context.CurrentModule = module; var js = new JSSpecialIdentifiers(context.CurrentModule.TypeSystem); var jsil = new JSILIdentifier(context.CurrentModule.TypeSystem, js); // Probably should be an argument, not a member variable... AstEmitter = new JavascriptAstEmitter( output, jsil, context.CurrentModule.TypeSystem, this.TypeInfoProvider ); foreach (var typedef in module.Types) ForwardDeclareType(context, output, typedef); foreach (var typedef in module.Types) { TranslateTypeDefinition(context, output, typedef, initializer, stubbed); SealType(context, output, typedef, sealedTypes); } }