001    // Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
002    // for details. All rights reserved. Use of this source code is governed by a
003    // BSD-style license that can be found in the LICENSE file.
004    
005    package com.google.dart.compiler.backend.js.ast;
006    
007    public abstract class JsNumberLiteral extends JsLiteral.JsValueLiteral {
008        public static final JsIntLiteral ZERO = new JsIntLiteral(0);
009    
010        public static final class JsDoubleLiteral extends JsNumberLiteral {
011            public final double value;
012    
013            JsDoubleLiteral(double value) {
014                this.value = value;
015            }
016    
017            @Override
018            public void accept(JsVisitor v) {
019                v.visitDouble(this);
020            }
021    
022            public String toString() {
023                return String.valueOf(value);
024            }
025        }
026    
027        public static final class JsIntLiteral extends JsNumberLiteral {
028            public final int value;
029    
030            JsIntLiteral(int value) {
031                this.value = value;
032            }
033    
034            @Override
035            public void accept(JsVisitor v) {
036                v.visitInt(this);
037            }
038    
039            public String toString() {
040                return String.valueOf(value);
041            }
042        }
043    }