forked from IronLanguages/main
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of http://github.com/ironruby/ironruby
- Loading branch information
Showing
162 changed files
with
8,654 additions
and
1,389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
Merlin/Main/Languages/IronPython/IronPython/Compiler/ReducableDynamicExpression.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* **************************************************************************** | ||
* | ||
* Copyright (c) Microsoft Corporation. | ||
* | ||
* This source code is subject to terms and conditions of the Microsoft Public License. A | ||
* copy of the license can be found in the License.html file at the root of this distribution. If | ||
* you cannot locate the Microsoft Public License, please send an email to | ||
* dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound | ||
* by the terms of the Microsoft Public License. | ||
* | ||
* You must not remove this notice, or any other, from this software. | ||
* | ||
* | ||
* ***************************************************************************/ | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using System.Reflection.Emit; | ||
using System.Runtime.CompilerServices; | ||
using System.Dynamic; | ||
|
||
namespace IronPython.Compiler { | ||
/// <summary> | ||
/// Provides a wrapper around "dynamic" expressions which we've opened coded (for optimized code generation). | ||
/// | ||
/// This lets us recognize both normal Dynamic and our own Dynamic expressions and apply the combo binder on them. | ||
/// </summary> | ||
class ReducableDynamicExpression : Expression { | ||
private readonly Expression/*!*/ _reduction; | ||
private readonly DynamicMetaObjectBinder/*!*/ _binder; | ||
private readonly Expression/*!*/[] _args; | ||
|
||
public ReducableDynamicExpression(Expression/*!*/ reduction, DynamicMetaObjectBinder/*!*/ binder, Expression/*!*/[]/*!*/ args) { | ||
_reduction = reduction; | ||
_binder = binder; | ||
_args = args; | ||
} | ||
|
||
public DynamicMetaObjectBinder/*!*/ Binder { | ||
get { | ||
return _binder; | ||
} | ||
} | ||
|
||
public Expression/*!*/[]/*!*/ Args { | ||
get { | ||
return _args; | ||
} | ||
} | ||
|
||
public override bool CanReduce { | ||
get { | ||
return true; | ||
} | ||
} | ||
|
||
protected override ExpressionType NodeTypeImpl() { | ||
return ExpressionType.Extension; | ||
} | ||
|
||
protected override Type TypeImpl() { | ||
return _reduction.Type; | ||
} | ||
|
||
public override Expression Reduce() { | ||
return _reduction; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.