This project has moved and is read-only. For the latest updates, please go here.


Bug in Irony.Interpreter.LanguageRuntime


Hi Roman,

Maybe I am doing something less than perfectly, but when creating an Ast tree I encountered null values in the BindingRequest.FromModule that caused an unhandled exception and failed Ast build

To reproduce
1) Create a language inheriting Grammar
2) Set the LanguageFlags = LanguageFlags.CreateAst; in the Grammar
3) Override BuildAst in the custom grammar with

public override void BuildAst(LanguageData language, ParseTree parseTree)
    if (!LanguageFlags.IsSet(LanguageFlags.CreateAst))

    var astContext = new InterpreterAstContext(language);
    var astBuilder = new AstBuilder(astContext);

To fix

I added a condition to Interpreter/LanguageRuntime/LanguageRuntime_Binding.cs that request.FromModule was not null, then the AstTree was created correctly
  //3. Check external module imports
  if (request.FromModule != null)
      foreach (var imp in request.FromModule.Imports)
          var result = imp.Bind(request);
          if (result != null)
              return result;
Closed Feb 26, 2013 at 5:18 AM by rivantsov


rivantsov wrote Feb 26, 2013 at 5:04 AM

sorry for not getting it soon. It seems like the this fix would not fit the general idea - that each request must come from a certain module, so FromModule is never null. The variable referencing a value cannot just fly in the air, it should be located in some module. So investigate why are you getting FromModule value null.