~oontvoo/+junk/test_hw

« back to all changes in this revision

Viewing changes to src/jminusminus/JDoWhileStatement.java

  • Committer: vnguyen
  • Date: 2013-05-09 20:11:19 UTC
  • Revision ID: oontvoo@hotmail.com-20130509201119-0kha5n03ca929puk
- add DoUntil, DoUnless
- implement Logical OR

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    @Override
32
32
    public JAST analyze(Context context)
33
33
    {
34
 
        // TODO
 
34
        test = test.analyze(context);
 
35
        test.type().mustMatchExpected(line(), Type.BOOLEAN);
 
36
        body = (JStatement) body.analyze(context);
35
37
        return this;
36
38
    }
37
39
 
38
40
    @Override
39
41
    public void codegen(CLEmitter output)
40
42
    {
41
 
        // TODO
 
43
        String start = output.createLabel();
 
44
        output.addLabel(start);
 
45
        body.codegen(output);
 
46
        test.codegen(output, start, true);
42
47
    }
43
48
 
44
49
    @Override