Expression.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. //
  2. // Expression.cs
  3. //
  4. // Author:
  5. // Jb Evain ([email protected])
  6. // Miguel de Icaza ([email protected])
  7. //
  8. // (C) 2008 Novell, Inc. (http://www.novell.com)
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. using System;
  30. using System.Collections.Generic;
  31. using System.Collections.ObjectModel;
  32. using System.Reflection;
  33. namespace System.Linq.Expressions {
  34. public abstract class Expression {
  35. ExpressionType node_type;
  36. Type type;
  37. public ExpressionType NodeType {
  38. get { return node_type; }
  39. }
  40. public Type Type {
  41. get { return type; }
  42. }
  43. // TODO: remove when all Expression subtypes
  44. // have their constructor implemented
  45. protected Expression ()
  46. {
  47. }
  48. protected Expression (ExpressionType node_type, Type type)
  49. {
  50. this.node_type = node_type;
  51. this.type = type;
  52. }
  53. public override string ToString ()
  54. {
  55. return ExpressionPrinter.ToString (this);
  56. }
  57. public static BinaryExpression Add (Expression left, Expression right)
  58. {
  59. return MakeBinary (ExpressionType.Add, left, right);
  60. }
  61. public static BinaryExpression Add (Expression left, Expression right, MethodInfo method)
  62. {
  63. return MakeBinary (ExpressionType.Add, left, right, false, method);
  64. }
  65. public static BinaryExpression AddChecked (Expression left, Expression right)
  66. {
  67. return MakeBinary (ExpressionType.AddChecked, left, right);
  68. }
  69. public static BinaryExpression AddChecked (Expression left, Expression right, MethodInfo method)
  70. {
  71. return MakeBinary (ExpressionType.AddChecked, left, right, false, method);
  72. }
  73. public static BinaryExpression And (Expression left, Expression right)
  74. {
  75. return MakeBinary (ExpressionType.And, left, right);
  76. }
  77. public static BinaryExpression And (Expression left, Expression right, MethodInfo method)
  78. {
  79. return MakeBinary (ExpressionType.And, left, right, false, method);
  80. }
  81. public static BinaryExpression AndAlso (Expression left, Expression right)
  82. {
  83. return MakeBinary (ExpressionType.AndAlso, left, right);
  84. }
  85. public static BinaryExpression AndAlso (Expression left, Expression right, MethodInfo method)
  86. {
  87. return MakeBinary (ExpressionType.AndAlso, left, right, false, method);
  88. }
  89. [MonoTODO]
  90. public static MethodCallExpression ArrayIndex (Expression left, params Expression [] indexes)
  91. {
  92. throw new NotImplementedException ();
  93. }
  94. [MonoTODO]
  95. public static MethodCallExpression ArrayIndex (Expression left, IEnumerable<Expression> indexes)
  96. {
  97. throw new NotImplementedException ();
  98. }
  99. [MonoTODO]
  100. public static BinaryExpression ArrayIndex (Expression left, Expression index)
  101. {
  102. throw new NotImplementedException ();
  103. }
  104. public static UnaryExpression ArrayLength (Expression array)
  105. {
  106. if (array == null)
  107. throw new ArgumentNullException ("array");
  108. if (!array.Type.IsArray)
  109. throw new ArgumentException ("The type of the expression must me Array");
  110. if (array.Type.GetArrayRank () != 1)
  111. throw new ArgumentException ("The array must be a single dimensional array");
  112. return new UnaryExpression (ExpressionType.ArrayLength, array, typeof (int));
  113. }
  114. [MonoTODO]
  115. public static MemberAssignment Bind (MemberInfo member, Expression expression)
  116. {
  117. throw new NotImplementedException ();
  118. }
  119. [MonoTODO]
  120. public static MemberAssignment Bind (MethodInfo propertyAccessor, Expression expression)
  121. {
  122. throw new NotImplementedException ();
  123. }
  124. [MonoTODO]
  125. public static MethodCallExpression Call (Expression instance, MethodInfo method)
  126. {
  127. throw new NotImplementedException ();
  128. }
  129. [MonoTODO]
  130. public static MethodCallExpression Call (MethodInfo method, params Expression [] arguments)
  131. {
  132. throw new NotImplementedException ();
  133. }
  134. [MonoTODO]
  135. public static MethodCallExpression Call (Expression instance, MethodInfo method, params Expression [] arguments)
  136. {
  137. throw new NotImplementedException ();
  138. }
  139. [MonoTODO]
  140. public static MethodCallExpression Call (Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
  141. {
  142. throw new NotImplementedException ();
  143. }
  144. [MonoTODO]
  145. public static MethodCallExpression Call (Expression instance, string methodName, Type [] typeArguments, params Expression [] arguments)
  146. {
  147. throw new NotImplementedException ();
  148. }
  149. [MonoTODO]
  150. public static MethodCallExpression Call (Type type, string methodName, Type [] typeArguments, params Expression [] arguments)
  151. {
  152. throw new NotImplementedException ();
  153. }
  154. public static BinaryExpression Coalesce (Expression left, Expression right)
  155. {
  156. return MakeBinary (ExpressionType.Coalesce, left, right);
  157. }
  158. public static BinaryExpression Coalesce (Expression left, Expression right, LambdaExpression conversion)
  159. {
  160. throw new NotImplementedException ();
  161. }
  162. [MonoTODO]
  163. public static ConditionalExpression Condition (Expression test, Expression ifTrue, Expression ifFalse)
  164. {
  165. throw new NotImplementedException ();
  166. }
  167. public static ConstantExpression Constant (object value)
  168. {
  169. if (value == null)
  170. return new ConstantExpression (null, typeof (object));
  171. return Constant (value, value.GetType ());
  172. }
  173. public static ConstantExpression Constant (object value, Type type)
  174. {
  175. if (type == null)
  176. throw new ArgumentNullException ("type");
  177. //
  178. // value must be compatible with type, no conversions
  179. // are allowed
  180. //
  181. if (value == null){
  182. if (type.IsValueType && !IsNullable (type))
  183. throw new ArgumentException ();
  184. } else {
  185. if (!(type.IsValueType && IsNullable (type)) && value.GetType () != type)
  186. throw new ArgumentException ();
  187. }
  188. return new ConstantExpression (value, type);
  189. }
  190. [MonoTODO]
  191. public static UnaryExpression Convert (Expression expression, Type type)
  192. {
  193. throw new NotImplementedException ();
  194. }
  195. [MonoTODO]
  196. public static UnaryExpression Convert (Expression expression, Type type, MethodInfo method)
  197. {
  198. throw new NotImplementedException ();
  199. }
  200. [MonoTODO]
  201. public static UnaryExpression ConvertChecked (Expression expression, Type type)
  202. {
  203. throw new NotImplementedException ();
  204. }
  205. [MonoTODO]
  206. public static UnaryExpression ConvertChecked (Expression expression, Type type, MethodInfo method)
  207. {
  208. throw new NotImplementedException ();
  209. }
  210. public static BinaryExpression Divide (Expression left, Expression right)
  211. {
  212. return MakeBinary (ExpressionType.Divide, left, right);
  213. }
  214. public static BinaryExpression Divide (Expression left, Expression right, MethodInfo method)
  215. {
  216. return MakeBinary (ExpressionType.Divide, left, right, false, method);
  217. }
  218. [MonoTODO]
  219. public static ElementInit ElementInit (MethodInfo addMethod, params Expression [] arguments)
  220. {
  221. throw new NotImplementedException ();
  222. }
  223. [MonoTODO]
  224. public static ElementInit ElementInit (MethodInfo addMethod, IEnumerable<Expression> arguments)
  225. {
  226. throw new NotImplementedException ();
  227. }
  228. [MonoTODO]
  229. public static BinaryExpression Equal (Expression left, Expression right)
  230. {
  231. return MakeBinary (ExpressionType.Equal, left, right);
  232. }
  233. public static BinaryExpression Equal (Expression left, Expression right, bool liftToNull, MethodInfo method)
  234. {
  235. BinaryExpression ret = MakeBinary (ExpressionType.Equal, left, right, liftToNull, method);
  236. return ret;
  237. }
  238. public static BinaryExpression ExclusiveOr (Expression left, Expression right)
  239. {
  240. return MakeBinary (ExpressionType.ExclusiveOr, left, right);
  241. }
  242. public static BinaryExpression ExclusiveOr (Expression left, Expression right, MethodInfo method)
  243. {
  244. return MakeBinary (ExpressionType.ExclusiveOr, left, right, false, method);
  245. }
  246. [MonoTODO]
  247. public static MemberExpression Field (Expression expression, FieldInfo field)
  248. {
  249. throw new NotImplementedException ();
  250. }
  251. [MonoTODO]
  252. public static MemberExpression Field (Expression expression, string fieldName)
  253. {
  254. throw new NotImplementedException ();
  255. }
  256. public static Type GetActionType (params Type [] typeArgs)
  257. {
  258. if (typeArgs == null)
  259. throw new ArgumentNullException ("typeArgs");
  260. if (typeArgs.Length > 4)
  261. throw new ArgumentException ("No Action type of this arity");
  262. if (typeArgs.Length == 0)
  263. return typeof (Action);
  264. Type action = null;
  265. switch (typeArgs.Length) {
  266. case 1:
  267. action = typeof (Action<>);
  268. break;
  269. case 2:
  270. action = typeof (Action<,>);
  271. break;
  272. case 3:
  273. action = typeof (Action<,,>);
  274. break;
  275. case 4:
  276. action = typeof (Action<,,,>);
  277. break;
  278. }
  279. return action.MakeGenericType (typeArgs);
  280. }
  281. public static Type GetFuncType (params Type [] typeArgs)
  282. {
  283. if (typeArgs == null)
  284. throw new ArgumentNullException ("typeArgs");
  285. if (typeArgs.Length < 1 || typeArgs.Length > 5)
  286. throw new ArgumentException ("No Func type of this arity");
  287. Type func = null;
  288. switch (typeArgs.Length) {
  289. case 1:
  290. func = typeof (Func<>);
  291. break;
  292. case 2:
  293. func = typeof (Func<,>);
  294. break;
  295. case 3:
  296. func = typeof (Func<,,>);
  297. break;
  298. case 4:
  299. func = typeof (Func<,,,>);
  300. break;
  301. case 5:
  302. func = typeof (Func<,,,,>);
  303. break;
  304. }
  305. return func.MakeGenericType (typeArgs);
  306. }
  307. public static BinaryExpression GreaterThan (Expression left, Expression right)
  308. {
  309. return MakeBinary (ExpressionType.GreaterThan, left, right);
  310. }
  311. public static BinaryExpression GreaterThan (Expression left, Expression right, bool liftToNull, MethodInfo method)
  312. {
  313. return MakeBinary (ExpressionType.GreaterThan, left, right, liftToNull, method);
  314. }
  315. public static BinaryExpression GreaterThanOrEqual (Expression left, Expression right)
  316. {
  317. return MakeBinary (ExpressionType.GreaterThanOrEqual, left, right);
  318. }
  319. public static BinaryExpression GreaterThanOrEqual (Expression left, Expression right, bool liftToNull, MethodInfo method)
  320. {
  321. return MakeBinary (ExpressionType.GreaterThanOrEqual, left, right, liftToNull, method);
  322. }
  323. [MonoTODO]
  324. public static InvocationExpression Invoke (Expression expression, params Expression [] arguments)
  325. {
  326. throw new NotImplementedException ();
  327. }
  328. [MonoTODO]
  329. public static InvocationExpression Invoke (Expression expression, IEnumerable<Expression> arguments)
  330. {
  331. throw new NotImplementedException ();
  332. }
  333. [MonoTODO]
  334. public static Expression<TDelegate> Lambda<TDelegate> (Expression body, params ParameterExpression [] parameters)
  335. {
  336. throw new NotImplementedException ();
  337. }
  338. [MonoTODO]
  339. public static Expression<TDelegate> Lambda<TDelegate> (Expression body, IEnumerable<ParameterExpression> parameters)
  340. {
  341. throw new NotImplementedException ();
  342. }
  343. [MonoTODO]
  344. public static LambdaExpression Lambda (Expression body, params ParameterExpression [] parameters)
  345. {
  346. throw new NotImplementedException ();
  347. }
  348. [MonoTODO]
  349. public static LambdaExpression Lambda (Type delegateType, Expression body, params ParameterExpression [] parameters)
  350. {
  351. throw new NotImplementedException ();
  352. }
  353. [MonoTODO]
  354. public static LambdaExpression Lambda (Type delegateType, Expression body, IEnumerable<ParameterExpression> parameters)
  355. {
  356. throw new NotImplementedException ();
  357. }
  358. public static BinaryExpression LeftShift (Expression left, Expression right)
  359. {
  360. return MakeBinary (ExpressionType.LeftShift, left, right);
  361. }
  362. public static BinaryExpression LeftShift (Expression left, Expression right, MethodInfo method)
  363. {
  364. return MakeBinary (ExpressionType.LeftShift, left, right, false, method);
  365. }
  366. public static BinaryExpression LessThan (Expression left, Expression right)
  367. {
  368. return MakeBinary (ExpressionType.LessThan, left, right);
  369. }
  370. public static BinaryExpression LessThan (Expression left, Expression right, bool liftToNull, MethodInfo method)
  371. {
  372. return MakeBinary (ExpressionType.LessThan, left, right, liftToNull, method);
  373. }
  374. public static BinaryExpression LessThanOrEqual (Expression left, Expression right)
  375. {
  376. return MakeBinary (ExpressionType.LessThanOrEqual, left, right);
  377. }
  378. public static BinaryExpression LessThanOrEqual (Expression left, Expression right, bool liftToNull, MethodInfo method)
  379. {
  380. return MakeBinary (ExpressionType.LessThanOrEqual, left, right, liftToNull, method);
  381. }
  382. public static MemberListBinding ListBind (MemberInfo member, params ElementInit [] initializers)
  383. {
  384. throw new NotImplementedException ();
  385. }
  386. [MonoTODO]
  387. public static MemberListBinding ListBind (MemberInfo member, IEnumerable<ElementInit> initializers)
  388. {
  389. throw new NotImplementedException ();
  390. }
  391. [MonoTODO]
  392. public static MemberListBinding ListBind (MethodInfo propertyAccessor, params ElementInit [] initializers)
  393. {
  394. throw new NotImplementedException ();
  395. }
  396. [MonoTODO]
  397. public static MemberListBinding ListBind (MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers)
  398. {
  399. throw new NotImplementedException ();
  400. }
  401. [MonoTODO]
  402. public static ListInitExpression ListInit (NewExpression newExpression, params ElementInit [] initializers)
  403. {
  404. throw new NotImplementedException ();
  405. }
  406. [MonoTODO]
  407. public static ListInitExpression ListInit (NewExpression newExpression, IEnumerable<ElementInit> initializers)
  408. {
  409. throw new NotImplementedException ();
  410. }
  411. [MonoTODO]
  412. public static ListInitExpression ListInit (NewExpression newExpression, params Expression [] initializers)
  413. {
  414. throw new NotImplementedException ();
  415. }
  416. [MonoTODO]
  417. public static ListInitExpression ListInit (NewExpression newExpression, IEnumerable<Expression> initializers)
  418. {
  419. throw new NotImplementedException ();
  420. }
  421. [MonoTODO]
  422. public static ListInitExpression ListInit (NewExpression newExpression, MethodInfo addMethod, params Expression [] initializers)
  423. {
  424. throw new NotImplementedException ();
  425. }
  426. [MonoTODO]
  427. public static ListInitExpression ListInit (NewExpression newExpression, MethodInfo addMethod, IEnumerable<Expression> initializers)
  428. {
  429. throw new NotImplementedException ();
  430. }
  431. public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right)
  432. {
  433. return MakeBinary (binaryType, left, right, false, null);
  434. }
  435. public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
  436. {
  437. if (left == null)
  438. throw new ArgumentNullException ("left");
  439. if (right == null)
  440. throw new ArgumentNullException ("right");
  441. if (method == null)
  442. throw new ArgumentNullException ("method");
  443. if (binaryType < 0 || binaryType > ExpressionType.TypeIs)
  444. throw new ArgumentException ("Out of range", "binaryType");
  445. BinaryExpression ret = new BinaryExpression (left, right, liftToNull, method);
  446. ret.node_type = binaryType;
  447. return ret;
  448. }
  449. [MonoTODO]
  450. public static BinaryExpression MakeBinary (ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
  451. {
  452. throw new NotImplementedException ();
  453. }
  454. [MonoTODO]
  455. public static MemberExpression MakeMemberAccess (Expression expression, MemberInfo member)
  456. {
  457. throw new NotImplementedException ();
  458. }
  459. public static UnaryExpression MakeUnary (ExpressionType unaryType, Expression operand, Type type)
  460. {
  461. return MakeUnary (unaryType, operand, type, null);
  462. }
  463. public static UnaryExpression MakeUnary (ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
  464. {
  465. switch (unaryType) {
  466. case ExpressionType.ArrayLength:
  467. return ArrayLength (operand);
  468. case ExpressionType.Convert:
  469. return Convert (operand, type, method);
  470. case ExpressionType.ConvertChecked:
  471. return ConvertChecked (operand, type, method);
  472. case ExpressionType.Negate:
  473. return Negate (operand, method);
  474. case ExpressionType.NegateChecked:
  475. return NegateChecked (operand, method);
  476. case ExpressionType.Not:
  477. return Not (operand, method);
  478. case ExpressionType.Quote:
  479. return Quote (operand);
  480. case ExpressionType.TypeAs:
  481. return TypeAs (operand, type);
  482. case ExpressionType.UnaryPlus:
  483. return UnaryPlus (operand, method);
  484. }
  485. throw new ArgumentException ("MakeUnary expect an unary operator");
  486. }
  487. [MonoTODO]
  488. public static MemberMemberBinding MemberBind (MemberInfo member, params MemberBinding [] binding)
  489. {
  490. throw new NotImplementedException ();
  491. }
  492. [MonoTODO]
  493. public static MemberMemberBinding MemberBind (MemberInfo member, IEnumerable<MemberBinding> binding)
  494. {
  495. throw new NotImplementedException ();
  496. }
  497. [MonoTODO]
  498. public static MemberMemberBinding MemberBind (MethodInfo propertyAccessor, params MemberBinding [] binding)
  499. {
  500. throw new NotImplementedException ();
  501. }
  502. [MonoTODO]
  503. public static MemberMemberBinding MemberBind (MethodInfo propertyAccessor, IEnumerable<MemberBinding> binding)
  504. {
  505. throw new NotImplementedException ();
  506. }
  507. [MonoTODO]
  508. public static MemberInitExpression MemberInit (NewExpression newExpression, params MemberBinding [] binding)
  509. {
  510. throw new NotImplementedException ();
  511. }
  512. [MonoTODO]
  513. public static MemberInitExpression MemberInit (NewExpression newExpression, IEnumerable<MemberBinding> binding)
  514. {
  515. throw new NotImplementedException ();
  516. }
  517. [MonoTODO]
  518. public static BinaryExpression Modulo (Expression left, Expression right)
  519. {
  520. throw new NotImplementedException ();
  521. }
  522. [MonoTODO]
  523. public static BinaryExpression Modulo (Expression left, Expression right, MethodInfo method)
  524. {
  525. throw new NotImplementedException ();
  526. }
  527. [MonoTODO]
  528. public static BinaryExpression Multiply (Expression left, Expression right)
  529. {
  530. throw new NotImplementedException ();
  531. }
  532. [MonoTODO]
  533. public static BinaryExpression Multiply (Expression left, Expression right, MethodInfo method)
  534. {
  535. throw new NotImplementedException ();
  536. }
  537. [MonoTODO]
  538. public static BinaryExpression MultiplyChecked (Expression left, Expression right)
  539. {
  540. throw new NotImplementedException ();
  541. }
  542. [MonoTODO]
  543. public static BinaryExpression MultiplyChecked (Expression left, Expression right, MethodInfo method)
  544. {
  545. throw new NotImplementedException ();
  546. }
  547. [MonoTODO]
  548. public static UnaryExpression Negate (Expression expression)
  549. {
  550. throw new NotImplementedException ();
  551. }
  552. [MonoTODO]
  553. public static UnaryExpression Negate (Expression expression, MethodInfo method)
  554. {
  555. throw new NotImplementedException ();
  556. }
  557. [MonoTODO]
  558. public static UnaryExpression NegateChecked (Expression expression)
  559. {
  560. throw new NotImplementedException ();
  561. }
  562. [MonoTODO]
  563. public static UnaryExpression NegateChecked (Expression expression, MethodInfo method)
  564. {
  565. throw new NotImplementedException ();
  566. }
  567. [MonoTODO]
  568. public static NewExpression New (ConstructorInfo constructor)
  569. {
  570. throw new NotImplementedException ();
  571. }
  572. [MonoTODO]
  573. public static NewExpression New (Type type)
  574. {
  575. throw new NotImplementedException ();
  576. }
  577. [MonoTODO]
  578. public static NewExpression New (ConstructorInfo constructor, params Expression [] arguments)
  579. {
  580. throw new NotImplementedException ();
  581. }
  582. [MonoTODO]
  583. public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments)
  584. {
  585. throw new NotImplementedException ();
  586. }
  587. [MonoTODO]
  588. public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments, params MemberInfo [] members)
  589. {
  590. throw new NotImplementedException ();
  591. }
  592. [MonoTODO]
  593. public static NewExpression New (ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
  594. {
  595. throw new NotImplementedException ();
  596. }
  597. [MonoTODO]
  598. public static NewArrayExpression NewArrayBounds (Type type, params Expression [] bounds)
  599. {
  600. throw new NotImplementedException ();
  601. }
  602. [MonoTODO]
  603. public static NewArrayExpression NewArrayBounds (Type type, IEnumerable<Expression> bounds)
  604. {
  605. throw new NotImplementedException ();
  606. }
  607. [MonoTODO]
  608. public static NewArrayExpression NewArrayInit (Type type, params Expression [] bounds)
  609. {
  610. throw new NotImplementedException ();
  611. }
  612. [MonoTODO]
  613. public static NewArrayExpression NewArrayInit (Type type, IEnumerable<Expression> bounds)
  614. {
  615. throw new NotImplementedException ();
  616. }
  617. [MonoTODO]
  618. public static UnaryExpression Not (Expression expression)
  619. {
  620. throw new NotImplementedException ();
  621. }
  622. [MonoTODO]
  623. public static UnaryExpression Not (Expression expression, MethodInfo method)
  624. {
  625. throw new NotImplementedException ();
  626. }
  627. [MonoTODO]
  628. public static BinaryExpression NotEqual (Expression left, Expression right)
  629. {
  630. throw new NotImplementedException ();
  631. }
  632. [MonoTODO]
  633. public static BinaryExpression NotEqual (Expression left, Expression right, bool liftToNull, MethodInfo method)
  634. {
  635. throw new NotImplementedException ();
  636. }
  637. [MonoTODO]
  638. public static BinaryExpression Or (Expression left, Expression right)
  639. {
  640. throw new NotImplementedException ();
  641. }
  642. [MonoTODO]
  643. public static BinaryExpression Or (Expression left, Expression right, MethodInfo method)
  644. {
  645. throw new NotImplementedException ();
  646. }
  647. [MonoTODO]
  648. public static BinaryExpression OrElse (Expression left, Expression right)
  649. {
  650. throw new NotImplementedException ();
  651. }
  652. [MonoTODO]
  653. public static BinaryExpression OrElse (Expression left, Expression right, MethodInfo method)
  654. {
  655. throw new NotImplementedException ();
  656. }
  657. [MonoTODO]
  658. public static ParameterExpression Parameter (Type type, string name)
  659. {
  660. throw new NotImplementedException ();
  661. }
  662. [MonoTODO]
  663. public static BinaryExpression Power (Expression left, Expression right)
  664. {
  665. throw new NotImplementedException ();
  666. }
  667. [MonoTODO]
  668. public static BinaryExpression Power (Expression left, Expression right, MethodInfo method)
  669. {
  670. throw new NotImplementedException ();
  671. }
  672. [MonoTODO]
  673. public static MemberExpression Property (Expression expression, MethodInfo propertyAccessor)
  674. {
  675. throw new NotImplementedException ();
  676. }
  677. [MonoTODO]
  678. public static MemberExpression Property (Expression expression, PropertyInfo property)
  679. {
  680. throw new NotImplementedException ();
  681. }
  682. [MonoTODO]
  683. public static MemberExpression Property (Expression expression, string propertyName)
  684. {
  685. throw new NotImplementedException ();
  686. }
  687. [MonoTODO]
  688. public static MemberExpression PropertyOrField (Expression expression, string propertyOrFieldName)
  689. {
  690. throw new NotImplementedException ();
  691. }
  692. public static UnaryExpression Quote (Expression expression)
  693. {
  694. if (expression == null)
  695. throw new ArgumentNullException ("expression");
  696. return new UnaryExpression (ExpressionType.Quote, expression);
  697. }
  698. [MonoTODO]
  699. public static BinaryExpression RightShift (Expression left, Expression right)
  700. {
  701. throw new NotImplementedException ();
  702. }
  703. [MonoTODO]
  704. public static BinaryExpression RightShift (Expression left, Expression right, MethodInfo method)
  705. {
  706. throw new NotImplementedException ();
  707. }
  708. [MonoTODO]
  709. public static BinaryExpression Subtract (Expression left, Expression right)
  710. {
  711. throw new NotImplementedException ();
  712. }
  713. [MonoTODO]
  714. public static BinaryExpression Subtract (Expression left, Expression right, MethodInfo method)
  715. {
  716. throw new NotImplementedException ();
  717. }
  718. [MonoTODO]
  719. public static BinaryExpression SubtractChecked (Expression left, Expression right)
  720. {
  721. throw new NotImplementedException ();
  722. }
  723. [MonoTODO]
  724. public static BinaryExpression SubtractChecked (Expression left, Expression right, MethodInfo method)
  725. {
  726. throw new NotImplementedException ();
  727. }
  728. public static UnaryExpression TypeAs (Expression expression, Type type)
  729. {
  730. if (expression == null)
  731. throw new ArgumentNullException ("expression");
  732. if (type == null)
  733. throw new ArgumentNullException ("type");
  734. return new UnaryExpression (ExpressionType.TypeAs, expression, type);
  735. }
  736. [MonoTODO]
  737. public static TypeBinaryExpression TypeIs (Expression expression, Type type)
  738. {
  739. throw new NotImplementedException ();
  740. }
  741. [MonoTODO]
  742. public static UnaryExpression UnaryPlus (Expression expression)
  743. {
  744. throw new NotImplementedException ();
  745. }
  746. [MonoTODO]
  747. public static UnaryExpression UnaryPlus (Expression expression, MethodInfo method)
  748. {
  749. throw new NotImplementedException ();
  750. }
  751. static bool IsNullable (Type type)
  752. {
  753. return type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>);
  754. }
  755. }
  756. }