PageRenderTime 36ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/IronPython_Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/IsDefinedExpression.cs

#
C# | 48 lines | 26 code | 8 blank | 14 comment | 0 complexity | 23795f13d011fc9ea5be5f2010ac3d50 MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  1. /* ****************************************************************************
  2. *
  3. * Copyright (c) Microsoft Corporation.
  4. *
  5. * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
  6. * copy of the license can be found in the License.html file at the root of this distribution. If
  7. * you cannot locate the Apache License, Version 2.0, please send an email to
  8. * ironruby@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. * by the terms of the Apache License, Version 2.0.
  10. *
  11. * You must not remove this notice, or any other, from this software.
  12. *
  13. *
  14. * ***************************************************************************/
  15. #if !CLR2
  16. using MSA = System.Linq.Expressions;
  17. #else
  18. using MSA = Microsoft.Scripting.Ast;
  19. #endif
  20. using Microsoft.Scripting;
  21. using Microsoft.Scripting.Utils;
  22. namespace IronRuby.Compiler.Ast {
  23. public partial class IsDefinedExpression : Expression {
  24. private readonly Expression/*!*/ _expression;
  25. public Expression/*!*/ Expression {
  26. get { return _expression; }
  27. }
  28. public IsDefinedExpression(Expression/*!*/ expression, SourceSpan location)
  29. : base(location) {
  30. Assert.NotNull(expression);
  31. _expression = expression;
  32. }
  33. internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
  34. return _expression.TransformIsDefined(gen);
  35. }
  36. internal override MSA.Expression/*!*/ TransformReadBoolean(AstGenerator/*!*/ gen, bool positive) {
  37. return _expression.TransformBooleanIsDefined(gen, positive);
  38. }
  39. }
  40. }