Yes. It probably should be a compile time error to access a field of an variant 
object without checking it first. Right now its a runtime error and is also 
pretty annoying.
    
    
    if node.kind == UnaryOpr:
      echo node.a
    
    
    Run

or
    
    
    case node.kind
    of UnaryOpr:
      echo node.a
    
    
    Run

Reply via email to