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