private void TranslateToILToCopyLocalsToNestedScope(ILGenerator il, FunctionScope nestedScope, JSLocalField[] notToBeRestored) { int length = this.fields.Length; for (int i = 0; i < length; i++) { JSLocalField outerLocalField = nestedScope.GetOuterLocalField(this.fields[i].Name); if (((outerLocalField != null) && (outerLocalField.outerField == this.fields[i])) && ((notToBeRestored == null) || !IsPresentIn(outerLocalField, notToBeRestored))) { il.Emit(OpCodes.Dup); ConstantWrapper.TranslateToILInt(il, this.fields[i].slotNumber); il.Emit(OpCodes.Ldelem_Ref); Microsoft.JScript.Convert.Emit(this.body, il, Typeob.Object, this.fields[i].FieldType); il.Emit(OpCodes.Stloc, (LocalBuilder) outerLocalField.metaData); } } il.Emit(OpCodes.Pop); }
private void TranslateToILToCopyLocalsFromNestedScope(ILGenerator il, FunctionScope nestedScope){ int offset = (this.attributes&MethodAttributes.Static) == MethodAttributes.Static ? 0 : 1; int n = this.fields.Length; for (int i = 0; i < n; i++){ JSLocalField field = nestedScope.GetOuterLocalField(this.fields[i].Name); if (field == null || field.outerField != this.fields[i]) continue; il.Emit(OpCodes.Dup); ConstantWrapper.TranslateToILInt(il, this.fields[i].slotNumber); il.Emit(OpCodes.Ldloc, (LocalBuilder)field.metaData); Convert.Emit(this.body, il, this.fields[i].FieldType, Typeob.Object); il.Emit(OpCodes.Stelem_Ref); } il.Emit(OpCodes.Pop); }