author | sundar |
Mon, 11 Feb 2013 21:26:06 +0530 | |
changeset 16226 | 0e4f37e6cc40 |
parent 16151 | 97c1e756ae1e |
child 18328 | ebd24057f163 |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.nashorn.internal.objects; |
|
27 |
||
28 |
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; |
|
29 |
||
30 |
import jdk.nashorn.internal.objects.annotations.Attribute; |
|
31 |
import jdk.nashorn.internal.objects.annotations.Constructor; |
|
32 |
import jdk.nashorn.internal.objects.annotations.Property; |
|
33 |
import jdk.nashorn.internal.objects.annotations.ScriptClass; |
|
34 |
import jdk.nashorn.internal.objects.annotations.Where; |
|
35 |
import jdk.nashorn.internal.runtime.JSType; |
|
36 |
import jdk.nashorn.internal.runtime.ScriptObject; |
|
37 |
||
38 |
/** |
|
39 |
* ECMA 15.11.6.1 EvalError |
|
40 |
* |
|
41 |
*/ |
|
42 |
@ScriptClass("Error") |
|
16226
0e4f37e6cc40
8007915: Nashorn IR, codegen, parser packages and Context instance should be inaccessible to user code
sundar
parents:
16151
diff
changeset
|
43 |
public final class NativeEvalError extends ScriptObject { |
16147 | 44 |
|
45 |
/** message property in instance */ |
|
46 |
@Property(name = NativeError.MESSAGE) |
|
47 |
public Object instMessage; |
|
48 |
||
49 |
/** error name property */ |
|
50 |
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) |
|
51 |
public Object name; |
|
52 |
||
53 |
/** ECMA 15.1.1.1 message property */ |
|
54 |
@Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) |
|
55 |
||
56 |
public Object message; |
|
57 |
NativeEvalError(final Object msg) { |
|
58 |
this.setProto(Global.instance().getEvalErrorPrototype()); |
|
59 |
if (msg != UNDEFINED) { |
|
60 |
this.instMessage = JSType.toString(msg); |
|
61 |
} else { |
|
62 |
this.delete(NativeError.MESSAGE, Global.isStrict()); |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
@Override |
|
67 |
public String getClassName() { |
|
68 |
return "Error"; |
|
69 |
} |
|
70 |
||
71 |
||
72 |
/** |
|
73 |
* ECMA 15.11.6.1 EvalError |
|
74 |
* |
|
75 |
* Constructor |
|
76 |
* |
|
77 |
* @param newObj was this error instantiated with the new operator |
|
78 |
* @param self self reference |
|
79 |
* @param msg error message |
|
80 |
* |
|
81 |
* @return new EvalError |
|
82 |
*/ |
|
83 |
@Constructor(name = "EvalError") |
|
84 |
public static Object constructor(final boolean newObj, final Object self, final Object msg) { |
|
85 |
return new NativeEvalError(msg); |
|
86 |
} |
|
87 |
} |