此代码在 C# 中运行良好:
Expression.Lambda(LambdaBody);
但是 IronRuby 似乎没有一种构建 AST 的方法。我需要 Microsoft.Scripting.Core 和 Microsoft.Scripting 库。我需要别的东西吗?这是 IronRuby 代码:
require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.scripting.core'
require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.dynamic'
require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.scripting'
include Microsoft::Scripting::Ast
p Expression.Lambda(lambda_body) #i have already constructed the lambda body
给出:
undefined method `Lambda' for #<TypeGroup: Microsoft::Scripting::Ast::Expression, Microsoft::Scripting::Ast::Expression[TDelegate]> (NoMethodError)
from -e:1:in `load'
from -e:1