raster@15779
|
1 |
/*
|
raster@15779
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
raster@15779
|
3 |
*
|
raster@15779
|
4 |
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
raster@15779
|
5 |
*
|
raster@15779
|
6 |
* The contents of this file are subject to the terms of either the GNU
|
raster@15779
|
7 |
* General Public License Version 2 only ("GPL") or the Common
|
raster@15779
|
8 |
* Development and Distribution License("CDDL") (collectively, the
|
raster@15779
|
9 |
* "License"). You may not use this file except in compliance with the
|
raster@15779
|
10 |
* License. You can obtain a copy of the License at
|
raster@15779
|
11 |
* http://www.netbeans.org/cddl-gplv2.html
|
raster@15779
|
12 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
raster@15779
|
13 |
* specific language governing permissions and limitations under the
|
raster@15779
|
14 |
* License. When distributing the software, include this License Header
|
raster@15779
|
15 |
* Notice in each file and include the License file at
|
raster@15779
|
16 |
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
|
raster@15779
|
17 |
* particular file as subject to the "Classpath" exception as provided
|
raster@15779
|
18 |
* by Sun in the GPL Version 2 section of the License file that
|
raster@15779
|
19 |
* accompanied this code. If applicable, add the following below the
|
raster@15779
|
20 |
* License Header, with the fields enclosed by brackets [] replaced by
|
raster@15779
|
21 |
* your own identifying information:
|
raster@15779
|
22 |
* "Portions Copyrighted [year] [name of copyright owner]"
|
raster@15779
|
23 |
*
|
raster@15779
|
24 |
* If you wish your version of this file to be governed by only the CDDL
|
raster@15779
|
25 |
* or only the GPL Version 2, indicate your decision by adding
|
raster@15779
|
26 |
* "[Contributor] elects to include this software in this distribution
|
raster@15779
|
27 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
raster@15779
|
28 |
* single choice of license, a recipient has the option to distribute
|
raster@15779
|
29 |
* your version of this file under either the CDDL, the GPL Version 2 or
|
raster@15779
|
30 |
* to extend the choice of license to its licensees as provided above.
|
raster@15779
|
31 |
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
raster@15779
|
32 |
* Version 2 license, then the option applies only if the new code is
|
raster@15779
|
33 |
* made subject to such option by the copyright holder.
|
raster@15779
|
34 |
*
|
raster@15779
|
35 |
* Contributor(s):
|
raster@15779
|
36 |
*
|
raster@15779
|
37 |
* Portions Copyrighted 2008 Sun Microsystems, Inc.
|
raster@15779
|
38 |
*/
|
raster@15779
|
39 |
package org.netbeans.modules.ada.editor.ast.nodes;
|
raster@15779
|
40 |
|
raster@15779
|
41 |
import org.netbeans.modules.ada.editor.ast.nodes.visitors.Visitor;
|
raster@15779
|
42 |
|
raster@15779
|
43 |
/**
|
raster@15779
|
44 |
* Represents an assignment statement.
|
raster@15779
|
45 |
* <pre>e.g.<pre>
|
raster@15779
|
46 |
* bar := 5,
|
raster@15779
|
47 |
* foo := 6 + 1
|
raster@15779
|
48 |
*/
|
raster@15779
|
49 |
public class Assignment extends Statement {
|
raster@15779
|
50 |
|
raster@16367
|
51 |
private NameBase leftHandSide;
|
raster@15779
|
52 |
private Expression rightHandSide;
|
raster@15779
|
53 |
|
raster@16367
|
54 |
public Assignment(int start, int end, NameBase leftHandSide, Expression rightHandSide) {
|
raster@15779
|
55 |
super(start, end);
|
raster@15779
|
56 |
if (leftHandSide == null ) {//|| rightHandSide == null) { TODO: must be correct
|
raster@15779
|
57 |
throw new IllegalArgumentException
|
raster@15779
|
58 |
("leftHandSide: " + leftHandSide +
|
raster@15779
|
59 |
", rightHandSide: " + rightHandSide);
|
raster@15779
|
60 |
}
|
raster@15779
|
61 |
this.leftHandSide = leftHandSide;
|
raster@15779
|
62 |
this.rightHandSide = rightHandSide;
|
raster@15779
|
63 |
}
|
raster@15779
|
64 |
|
raster@15779
|
65 |
/**
|
raster@15779
|
66 |
* Returns the left hand side of this assignment expression.
|
raster@15779
|
67 |
*
|
raster@15779
|
68 |
* @return the left hand side node
|
raster@15779
|
69 |
*/
|
raster@16367
|
70 |
public NameBase getLeftHandSide() {
|
raster@15779
|
71 |
return this.leftHandSide;
|
raster@15779
|
72 |
}
|
raster@15779
|
73 |
|
raster@15779
|
74 |
/**
|
raster@15779
|
75 |
* Returns the right hand side of this assignment expression.
|
raster@15779
|
76 |
*
|
raster@15779
|
77 |
* @return the right hand side node
|
raster@15779
|
78 |
*/
|
raster@15779
|
79 |
public Expression getRightHandSide() {
|
raster@15779
|
80 |
return this.rightHandSide;
|
raster@15779
|
81 |
}
|
raster@15779
|
82 |
|
raster@15779
|
83 |
@Override
|
raster@15779
|
84 |
public void accept(Visitor visitor) {
|
raster@15779
|
85 |
visitor.visit(this);
|
raster@15779
|
86 |
}
|
raster@15779
|
87 |
}
|