001/*
002 * Copyright (c) 2012-2017 Institut National des Sciences Appliquées de Lyon (INSA-Lyon)
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 */
009
010package org.eclipse.golo.compiler.ir;
011
012public class ConstantStatement extends ExpressionStatement {
013
014  private Object value;
015
016  ConstantStatement(Object value) {
017    super();
018    this.value = value;
019  }
020
021  public Object getValue() {
022    return value;
023  }
024
025  public void setValue(Object v) {
026    value = v;
027  }
028
029  @Override
030  public String toString() {
031    return String.valueOf(value);
032  }
033
034  @Override
035  public void accept(GoloIrVisitor visitor) {
036    visitor.visitConstantStatement(this);
037  }
038
039  @Override
040  public void walk(GoloIrVisitor visitor) {
041    // nothing to do, not a composite
042  }
043
044  @Override
045  protected void replaceElement(GoloElement original, GoloElement newElement) {
046    throw cantReplace();
047  }
048
049}