01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.dev.js.ast;
17:
18: /**
19: * Used in object literals to specify property values by name.
20: */
21: public class JsPropertyInitializer extends
22: JsNode<JsPropertyInitializer> {
23:
24: private JsExpression labelExpr;
25:
26: private JsExpression valueExpr;
27:
28: public JsPropertyInitializer() {
29: }
30:
31: public JsPropertyInitializer(JsExpression labelExpr,
32: JsExpression valueExpr) {
33: this .labelExpr = labelExpr;
34: this .valueExpr = valueExpr;
35: }
36:
37: public JsExpression getLabelExpr() {
38: return labelExpr;
39: }
40:
41: public JsExpression getValueExpr() {
42: return valueExpr;
43: }
44:
45: public void setLabelExpr(JsExpression labelExpr) {
46: this .labelExpr = labelExpr;
47: }
48:
49: public void setValueExpr(JsExpression valueExpr) {
50: this .valueExpr = valueExpr;
51: }
52:
53: public void traverse(JsVisitor v,
54: JsContext<JsPropertyInitializer> ctx) {
55: if (v.visit(this, ctx)) {
56: labelExpr = v.accept(labelExpr);
57: valueExpr = v.accept(valueExpr);
58: }
59: v.endVisit(this, ctx);
60: }
61: }
|