Class: C::AssignmentExpression
- Inherits:
-
Object
- Object
- C::AssignmentExpression
- Defined in:
- lib/csquare.rb
Instance Method Summary collapse
- #involves_on_left?(literal_or_variables) ⇒ Boolean
- #involves_on_right?(literal_or_variables) ⇒ Boolean
-
#recombine!(function, blueprint, type_symbol, return_type = nil) ⇒ Object
Replace some expression with the pattern from Blueprint.
- #return_typename(function, blueprint) ⇒ Object
Instance Method Details
#involves_on_left?(literal_or_variables) ⇒ Boolean
812 813 814 815 |
# File 'lib/csquare.rb', line 812 def involves_on_left? literal_or_variables return lval.involves?(literal_or_variables) if lval.Expression? false end |
#involves_on_right?(literal_or_variables) ⇒ Boolean
817 818 819 820 |
# File 'lib/csquare.rb', line 817 def involves_on_right? literal_or_variables return rval.involves?(literal_or_variables) if rval.Expression? false end |
#recombine!(function, blueprint, type_symbol, return_type = nil) ⇒ Object
Replace some expression with the pattern from Blueprint.
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 |
# File 'lib/csquare.rb', line 827 def recombine! function, blueprint, type_symbol, return_type=nil args_types = {} # Determine the left-hand return type return_type = self.lval.return_typename(function, blueprint) # Recombine on the right-hand side # r_result: ast, return type (or just nil) r_result = self.rval.recombine! function, blueprint, type_symbol, return_type args_types[self.lval.csquare_key] = self.lval.return_typename(function, blueprint) args_types[r_result[0].csquare_key] = r_result[1] rval.replace_with(r_result[0]) unless r_result.nil? || rval == r_result[0] if blueprint.has_op?(op) && blueprint.responds_to_typename?(return_type) blueprint.decorated_expression(type_symbol, op, args_types, return_type) end end |
#return_typename(function, blueprint) ⇒ Object
822 823 824 |
# File 'lib/csquare.rb', line 822 def return_typename function, blueprint self.lval.return_typename function, blueprint end |