visitRawExpr method

  1. @override
Object? visitRawExpr(
  1. RawExpr rawExpr
)
override

Implementation

@override
Object? visitRawExpr(RawExpr rawExpr) {
  final id = rawExpr.token.lexeme;

  if (hasContext) {
    final field = context!.readField(id);
    if (field == null) {
      final variable = findVar(id);
      if (variable == null) {
        // Promote this field to a new object.
        // Likely is the case that this object
        // will be given a value in the next
        // statement as an assignment statement.
        return context!.writeField(id, LuaObject.nil(id));
      } else {
        return variable;
      }
    }
    return field;
  }

  return findVar(id);
}