File: this.bsh

package info (click to toggle)
bsh 2.0b4-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 4,224 kB
  • sloc: java: 23,431; xml: 4,500; sh: 139; makefile: 24
file content (78 lines) | stat: -rw-r--r-- 1,674 bytes parent folder | download | duplicates (10)
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
72
73
74
75
76
77
78
#!/bin/java bsh.Interpreter

source("TestHarness.bsh");

import java.math.BigDecimal;

ths = this;
assert( !(this.namespace instanceof bsh.BlockNameSpace) );

booga() { print("booga"); }
booga();
this.booga();

if ( true ) 
{
print("here1");
  assert( !(this.namespace instanceof bsh.BlockNameSpace) );
  BigDecimal c = new BigDecimal("1.0");
print("here2");
  print(c); 
print("here3");
  assert( this.c == void ); 
  assert( this == ths );
  { // another block
  	assert( this == ths );
	assert( this.c == void );
  }
print("here4");
  blockthis = this;
  assert( this == blockthis );
  assert( blockthis == ths );
  this.foo=5;
  assert(foo==5);
  assert(this.foo==5);
  goo() { print("goo"); }
  goo();
  //this.goo(); // doesn't work.  If it's important see NameSpace.java comment.
} 

{
  assert( !(this.namespace instanceof bsh.BlockNameSpace) );
  BigDecimal c = new BigDecimal("1.0");
  print(c); 
  assert(this.c==void);
  assert( this == ths );
  blockthis = this;
  assert( this == blockthis );
  assert( blockthis == ths );
} 

void method1()  
{
  assert( !(this.namespace instanceof bsh.BlockNameSpace) );
  assert ( super == ths );
  BigDecimal cost = new BigDecimal("1.0");
  assert(cost == this.cost );
  assert( this.cost == cost );
  mthis = this;

  boolean condition1=true;
  if (condition1) 
  {
  	 assert( this == mthis );
	 BigDecimal finalCost1 = new BigDecimal("1.0");
	 print(finalCost1); 
	 print(this);
  }
}

// dissallow assignment to magic members
assert( isEvalError("this.namespace=5") );
assert( isEvalError("this.caller=5") );
assert( isEvalError("this.variables=5") );
assert( isEvalError("this.methods=5") );

method1();

complete();