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.PropertyMap;
37 import jdk.nashorn.internal.runtime.ScriptObject;
38
39 /**
40 * ECMA 15.11.6.1 EvalError
41 *
42 */
43 @ScriptClass("Error")
44 public final class NativeEvalError extends ScriptObject {
45
46 /** message property in instance */
47 @Property(name = NativeError.MESSAGE)
48 public Object instMessage;
49
50 /** error name property */
51 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
52 public Object name;
53
54 /** ECMA 15.1.1.1 message property */
55 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
56 public Object message;
57
58 // initialized by nasgen
59 private static PropertyMap $nasgenmap$;
60
61 static PropertyMap getInitialMap() {
62 return $nasgenmap$;
63 }
64
65 private NativeEvalError(final Object msg, final ScriptObject proto, final PropertyMap map) {
66 super(proto, map);
67 if (msg != UNDEFINED) {
68 this.instMessage = JSType.toString(msg);
69 } else {
70 this.delete(NativeError.MESSAGE, false);
71 }
72 }
73
74 NativeEvalError(final Object msg, final Global global) {
75 this(msg, global.getEvalErrorPrototype(), global.getEvalErrorMap());
76 }
77
78 private NativeEvalError(final Object msg) {
79 this(msg, Global.instance());
80 }
81
82 @Override
83 public String getClassName() {
84 return "Error";
85 }
86
87 /**
88 * ECMA 15.11.6.1 EvalError
89 *
90 * Constructor
91 *
92 * @param newObj was this error instantiated with the new operator
93 * @param self self reference
94 * @param msg error message
95 *
|
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.PropertyMap;
37 import jdk.nashorn.internal.runtime.ScriptObject;
38
39 /**
40 * ECMA 15.11.6.1 EvalError
41 *
42 */
43 @ScriptClass("Error")
44 public final class NativeEvalError extends ScriptObject {
45
46 /** message property in instance */
47 @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE)
48 public Object instMessage;
49
50 /** error name property */
51 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
52 public Object name;
53
54 /** ECMA 15.1.1.1 message property */
55 @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
56 public Object message;
57
58 /** Nashorn extension: underlying exception */
59 @Property(attributes = Attribute.NOT_ENUMERABLE)
60 public Object nashornException;
61
62 // initialized by nasgen
63 private static PropertyMap $nasgenmap$;
64
65 @SuppressWarnings("LeakingThisInConstructor")
66 private NativeEvalError(final Object msg, final ScriptObject proto, final PropertyMap map) {
67 super(proto, map);
68 if (msg != UNDEFINED) {
69 this.instMessage = JSType.toString(msg);
70 } else {
71 this.delete(NativeError.MESSAGE, false);
72 }
73 NativeError.initException(this);
74 }
75
76 NativeEvalError(final Object msg, final Global global) {
77 this(msg, global.getEvalErrorPrototype(), $nasgenmap$);
78 }
79
80 private NativeEvalError(final Object msg) {
81 this(msg, Global.instance());
82 }
83
84 @Override
85 public String getClassName() {
86 return "Error";
87 }
88
89 /**
90 * ECMA 15.11.6.1 EvalError
91 *
92 * Constructor
93 *
94 * @param newObj was this error instantiated with the new operator
95 * @param self self reference
96 * @param msg error message
97 *
|