Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2014-03-11 17:13:43 +0400
committerMarek Safar <marek.safar@gmail.com>2014-03-11 17:29:55 +0400
commit2fd90f98a429cd4f3f2bab7a36213cc2022c4820 (patch)
treeaf8347f977a2c0c75171c738426d1b384b0bb6ce /mcs/class/dlr
parent07b4f05070de8455644f348fa5e569014d21848d (diff)
[interpreter] Implement simple quote expression. Fixes #18248
Diffstat (limited to 'mcs/class/dlr')
-rw-r--r--mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs9
-rw-r--r--mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs6
-rw-r--r--mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs10
3 files changed, 15 insertions, 10 deletions
diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs
index c200ab12144..1ef324c25db 100644
--- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs
+++ b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs
@@ -35,16 +35,13 @@ using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;
namespace Microsoft.Scripting.Interpreter {
- abstract class ConstantInstruction : Instruction {
+ sealed class PushValueInstruction : Instruction {
+ object value;
public override int ConsumedStack { get { return 0; } }
public override int ProducedStack { get { return 1; } }
- }
-
- sealed class PushIntegerValueInstruction : ConstantInstruction {
- int value;
- public PushIntegerValueInstruction (int value)
+ public PushValueInstruction (object value)
{
this.value = value;
}
diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs
index 9dd35973edb..d6ebd1ae35f 100644
--- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs
+++ b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs
@@ -365,6 +365,10 @@ namespace Microsoft.Scripting.Interpreter {
Emit(PopInstruction.Instance);
}
+ public void EmitStore(object value) {
+ Emit (new PushValueInstruction (value));
+ }
+
#endregion
#region Locals
@@ -665,7 +669,7 @@ namespace Microsoft.Scripting.Interpreter {
#endregion
public void EmitIncrement (Type type) {
- Emit (new PushIntegerValueInstruction (1));
+ Emit (new PushValueInstruction (1));
EmitAdd (type, false);
}
diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs
index fe0ff2c8af4..61a0974e6e0 100644
--- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs
+++ b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs
@@ -1478,6 +1478,10 @@ namespace Microsoft.Scripting.Interpreter {
_instructions.EmitCreateDelegate(creator);
}
+ private void CompileQuotedLambdaExpression(Expression expr) {
+ _instructions.EmitStore (expr);
+ }
+
private void CompileCoalesceBinaryExpression(Expression expr) {
var node = (BinaryExpression)expr;
@@ -1531,9 +1535,9 @@ namespace Microsoft.Scripting.Interpreter {
throw new System.NotImplementedException();
}
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "expr")]
- private void CompileQuoteUnaryExpression(Expression expr) {
- throw new System.NotImplementedException();
+ private void CompileQuoteUnaryExpression(Expression expr) {
+ var qe = (UnaryExpression)expr;
+ CompileQuotedLambdaExpression (qe.Operand);
}
private void CompileUnboxUnaryExpression(Expression expr) {