StaticTypeInspector.java revision 822:005ac813256a
1168404Spjd/* 2168404Spjd * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3168404Spjd * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4168404Spjd * 5168404Spjd * This code is free software; you can redistribute it and/or modify it 6168404Spjd * under the terms of the GNU General Public License version 2 only, as 7168404Spjd * published by the Free Software Foundation. Oracle designates this 8168404Spjd * particular file as subject to the "Classpath" exception as provided 9168404Spjd * by Oracle in the LICENSE file that accompanied this code. 10168404Spjd * 11168404Spjd * This code is distributed in the hope that it will be useful, but WITHOUT 12168404Spjd * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13168404Spjd * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14168404Spjd * version 2 for more details (a copy is included in the LICENSE file that 15168404Spjd * accompanied this code). 16168404Spjd * 17168404Spjd * You should have received a copy of the GNU General Public License version 18168404Spjd * 2 along with this work; if not, write to the Free Software Foundation, 19168404Spjd * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20168404Spjd * 21168404Spjd * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22219089Spjd * or visit www.oracle.com if you need additional information or have any 23249195Smm * questions. 24168404Spjd */ 25251478Sdelphijpackage jdk.nashorn.test.tools; 26255750Sdelphij 27251478Sdelphijimport jdk.nashorn.internal.runtime.Undefined; 28168404Spjd 29168404Spjdpublic class StaticTypeInspector { 30168404Spjd 31168404Spjd public static String inspect(boolean x, String w) { 32168404Spjd return w + ": boolean"; 33168404Spjd } 34168404Spjd 35168404Spjd public static String inspect(int x, String w) { 36168404Spjd return w + ": int"; 37168404Spjd } 38168404Spjd 39168404Spjd public static String inspect(long x, String w) { 40168404Spjd return w + ": long"; 41168404Spjd } 42168404Spjd 43168404Spjd public static String inspect(double x, String w) { 44168404Spjd return w + ": double"; 45243524Smm } 46219089Spjd 47219089Spjd public static String inspect(Undefined x, String w) { 48185029Spjd return w + ": undefined"; 49219089Spjd } 50168404Spjd 51243524Smm public static String inspect(Object x, String w) { 52243524Smm return w + ": object"; 53243524Smm } 54243524Smm}