1 28 29 package com.caucho.es.parser; 30 31 import com.caucho.es.ESException; 32 33 import java.io.IOException ; 34 35 40 class FieldExpr extends Expr { 41 Expr lhs; 42 Expr field; 43 44 FieldExpr(Block block, Expr lhs, Expr field) 45 { 46 super(block); 47 48 this.lhs = lhs; 49 this.field = field; 50 51 if (lhs != null) 52 lhs.setUsed(); 53 if (field != null) 54 field.setUsed(); 55 } 56 57 60 Expr getExpr() 61 { 62 return lhs; 63 } 64 65 68 Expr getField() 69 { 70 return field; 71 } 72 73 76 int getType() 77 { 78 return TYPE_ES; 79 } 80 81 Expr assign(Expr value) 82 throws ESException 83 { 84 return new AssignExpr(block, lhs, field, value); 85 } 86 87 Expr delete() 88 { 89 return new DeleteExpr(block, lhs, field); 90 } 91 92 Expr prefix(int op) 93 { 94 if (op == '+') 95 return new PostfixExpr(block, PostfixExpr.PREINC, this); 96 else 97 return new PostfixExpr(block, PostfixExpr.PREDEC, this); 98 } 99 100 Expr postfix(int op) 101 { 102 if (op == '+') 103 return new PostfixExpr(block, PostfixExpr.POSTINC, this); 104 else 105 return new PostfixExpr(block, PostfixExpr.POSTDEC, this); 106 } 107 108 CallExpr startCall() 109 throws ESException 110 { 111 return new CallExpr(block, lhs, field, false); 112 } 113 114 CallExpr startNew() 115 throws ESException 116 { 117 return new CallExpr(block, lhs, field, true); 118 } 119 120 void printImpl() throws IOException 121 { 122 lhs.print(); 123 cl.print(".getProperty("); 124 field.printStr(); 125 cl.print(")"); 126 } 127 } 128 | Popular Tags |