Example #1
0
 def exitExpression1(self, ctx: JavaParserLabeled.Expression1Context):
     if self.in_source_class and self.in_selected_package:
         try:
             if ctx.parentCtx.getChild(1).getText() in ('=', '+=', '-=',
                                                        '*=', '/=', '&=',
                                                        '|=', '^=', '>>=',
                                                        '>>>=', '<<=', '%=') and \
                     ctx.parentCtx.getChild(0) == ctx:
                 return
         except:
             pass
         if ctx.getText() == 'this.' + self.field_identifier:
             new_code = 'this.get' + str.capitalize(
                 self.field_identifier) + '()'
             self.token_stream_rewriter.replaceRange(
                 ctx.start.tokenIndex, ctx.stop.tokenIndex, new_code)
Example #2
0
 def enterExpression1(self, ctx: JavaParserLabeled.Expression1Context):
     if self.fields and ctx.expression().getText() == "this":
         for field in self.fields:
             if field in ctx.getText() and field not in self.moved_fields:
                 self.token_stream_rewriter.replaceSingleToken(
                     token=ctx.expression().primary().start, text="ref")
Example #3
0
 def enterExpression1(self, ctx: JavaParserLabeled.Expression1Context):
     if self.is_package_imported or self.package_identifier is None or self.in_selected_package:
         for object_name in self.declared_objects_names:
             if ctx.getText() == object_name + "." + self.field_identifier:
                 self.token_stream_rewriter.replaceIndex(
                     index=ctx.start.tokenIndex, text=self.class_identifier)