1
Vote

why for DefaultAstNodeCreator is created? in which condition does this method called in ASTBuilder class file of Irony?

description

why for DefaultAstNodeCreator is created? in which condition does this method called in ASTBuilder class file of Irony?

I am facing issue in .netcore

comments

rivantsov wrote Jun 16 at 5:36 PM

It is a fast method to create AstNode from astNodeConfig.NodeType.
Normally you would specify AstNodeType for NonTErminals. The parser would then create instances of this type. One (slow) way is to use Activator.CreateObject() - this uses Reflection. To speed up process AstBuilder creates a compiled method - using ILEmit. Also it allows grammar author to provide custom method that will be creating nodes (so no 'default' IL-generated method).
I understand the Reflection.Emit is not available in base .NET standard, it is platfrom specific. So just remove DefaultNodeCreator and go with Activator instead when creating nodes from node type.

KalaiselviAthi wrote Jun 19 at 7:09 AM

Thank you Ivan..I am using .netcore 2 preview now .Could you please let me know how to replace that defaultAstNodeCreator to Activator.CreateObject in AstBuilder?