File: OTMModAssign.m

package info (click to toggle)
tom 1.1.1-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,340 kB
  • ctags: 2,244
  • sloc: objc: 27,863; ansic: 9,804; sh: 7,411; yacc: 3,377; lex: 966; asm: 208; makefile: 62; cpp: 10
file content (71 lines) | stat: -rw-r--r-- 1,653 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
   Written by Pieter J. Schoenmakers <tiggr@ics.ele.tue.nl>

   Copyright (C) 1996 Pieter J. Schoenmakers.

   This file is part of TOM.  TOM is distributed under the terms of the
   TOM License, a copy of which can be found in the TOM distribution; see
   the file LICENSE.

   $Id: OTMModAssign.m,v 1.10 1998/01/05 01:13:28 tiggr Exp $  */

#define OTMMODASSIGN_DECLARE_PRIVATE_METHODS
#import "OTMModAssign.h"
#import "OTMMethod.h"
#import "OTMType.h"
#import "OTMUnvocation.h"
#import "global.h"

@implementation OTMModAssign

+(OTMModAssign *) assignmentWithLhs: (OTMExpr *) l
				rhs: (OTMExpr *) r
			   operator: (enum builtin_operator) o
			      postp: (BOOL) p
{
  return [[self gcAlloc] initWithLhs: l rhs: r operator: o postp: p];
}

-(id) elaborate
{
  OTMExpr *result;

  if (!post_not_pre)
    result = lhs;
  else
    {
      result = temp_something_with_type ([lhs type], YES);
      emit_assignment (result, lhs);
    }

  rhs = [rhs elaborate];

  emit_assignment (lhs, rhs);

  return result;
}

-(id) initWithLhs: (OTMExpr *) l
	      rhs: (OTMExpr *) r
	 operator: (enum builtin_operator) o
	    postp: (BOOL) p
{
  if (![super initWithType: nil])
    return nil;

  lhs = l;
  post_not_pre = p;
  rhs = [CO_OTMUnvocation unvocationWithReceiver:
		       [[CO_OTMExpr gcAlloc] initWithType:
					  [[current_either itsClass] semantics]]
		       sender: [current_either semantics]
		       arguments: [CO_TLVector vectorWithElements: 2, l, r]
		       nameParts: [CO_TLVector vectorWithElements: 2,
					    builtin_operator_name[o],
					    unique_identifier_colon]
		       super: NO confined: nil];

  return self;
}

@end