1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
\r
3 * The contents of this file are subject to the Netscape Public
\r
4 * License Version 1.1 (the "License"); you may not use this file
\r
5 * except in compliance with the License. You may obtain a copy of
\r
6 * the License at http://www.mozilla.org/NPL/
\r
8 * Software distributed under the License is distributed on an "AS
\r
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
\r
10 * implied. See the License for the specific language governing
\r
11 * rights and limitations under the License.
\r
13 * The Original Code is Rhino code, released
\r
16 * The Initial Developer of the Original Code is Netscape
\r
17 * Communications Corporation. Portions created by Netscape are
\r
18 * Copyright (C) 1997-1999 Netscape Communications Corporation. All
\r
24 * Alternatively, the contents of this file may be used under the
\r
25 * terms of the GNU Public License (the "GPL"), in which case the
\r
26 * provisions of the GPL are applicable instead of those above.
\r
27 * If you wish to allow use of your version of this file only
\r
28 * under the terms of the GPL and not to allow others to use your
\r
29 * version of this file under the NPL, indicate your decision by
\r
30 * deleting the provisions above and replace them with the notice
\r
31 * and other provisions required by the GPL. If you do not delete
\r
32 * the provisions above, a recipient may use your version of this
\r
33 * file under either the NPL or the GPL.
\r
36 package org.mozilla.javascript;
\r
39 * This class implements the Undefined value in JavaScript.
\r
41 public class Undefined implements Scriptable {
\r
43 static final public Scriptable instance = new Undefined();
\r
45 public String getClassName() {
\r
49 public boolean has(String id, Scriptable start) {
\r
53 public boolean has(int index, Scriptable start) {
\r
57 public Object get(String id, Scriptable start) {
\r
58 throw reportError();
\r
61 public Object get(int index, Scriptable start) {
\r
62 throw reportError();
\r
65 public void put(String id,Scriptable start, Object value) {
\r
66 throw reportError();
\r
69 public void put(int index, Scriptable start, Object value) {
\r
70 throw reportError();
\r
73 public void delete(String id) {
\r
74 throw reportError();
\r
77 public void delete(int index) {
\r
78 throw reportError();
\r
81 public short getAttributes(String id, Scriptable start) {
\r
82 throw reportError();
\r
85 public short getAttributes(int index, Scriptable start) {
\r
86 throw reportError();
\r
89 public void setAttributes(String id, Scriptable start, short attributes) {
\r
90 throw reportError();
\r
93 public void setAttributes(int index, Scriptable start, short attributes) {
\r
94 throw reportError();
\r
97 public Scriptable getPrototype() {
\r
98 throw reportError();
\r
101 public void setPrototype(Scriptable prototype) {
\r
102 throw reportError();
\r
105 public Scriptable getParentScope() {
\r
106 throw reportError();
\r
109 public void setParentScope(Scriptable parent) {
\r
110 throw reportError();
\r
113 public Object[] getIds() {
\r
114 throw reportError();
\r
117 public Object getDefaultValue(Class cl) {
\r
118 if (cl == ScriptRuntime.StringClass)
\r
119 return "undefined";
\r
120 if (cl == ScriptRuntime.NumberClass)
\r
121 return ScriptRuntime.NaNobj;
\r
122 if (cl == ScriptRuntime.BooleanClass)
\r
123 return Boolean.FALSE;
\r
127 public boolean hasInstance(Scriptable value) {
\r
128 throw reportError();
\r
131 public boolean instanceOf(Scriptable prototype) {
\r
135 private RuntimeException reportError() {
\r
136 return Context.reportRuntimeError0("msg.undefined");
\r