22 #include "reference.h"
35 propertyNameIsNumber(false),
40 Reference::Reference(
const Object& b,
unsigned p)
42 propertyNameAsNumber(p),
44 propertyNameIsNumber(true)
48 Reference::Reference(ObjectImp *b,
const Identifier& p)
51 propertyNameIsNumber(false),
56 Reference::Reference(ObjectImp *b,
unsigned p)
58 propertyNameAsNumber(p),
60 propertyNameIsNumber(true)
67 propertyNameIsNumber(false),
72 Reference::Reference(
const Null& b,
unsigned p)
74 propertyNameAsNumber(p),
76 propertyNameIsNumber(true)
84 valueRef.baseIsValue =
true;
88 Reference::Reference()
96 exec->setException(err);
112 if (propertyNameIsNumber && prop.
isNull())
113 prop = Identifier::from(propertyNameAsNumber);
128 exec->setException(err);
132 if (o.
type() != ObjectType) {
133 UString m = I18N_NOOP(
"Base is not an object");
135 exec->setException(err);
139 ObjectImp *oimp =
static_cast<ObjectImp*
>(o.imp());
140 if (propertyNameIsNumber)
141 return oimp->getPropertyByIndex(exec, propertyNameAsNumber);
142 return oimp->
get(exec, prop);
149 exec->setException(err);
157 if (o.
type() == NullType)
158 o =
Value(exec->
context().imp()->scopeChain().bottom());
160 ObjectImp *oimp =
static_cast<ObjectImp*
>(o.imp());
161 if (propertyNameIsNumber)
162 oimp->putPropertyByIndex(exec, propertyNameAsNumber, w);
164 oimp->put(exec, prop, w);
167 bool Reference::deleteValue(
ExecState *exec)
171 exec->setException(err);
178 if (b.
type() != ObjectType) {
179 assert(b.
type() == NullType);
183 ObjectImp *bimp =
static_cast<ObjectImp*
>(b.imp());
184 if (propertyNameIsNumber)
185 return bimp->deletePropertyByIndex(exec, propertyNameAsNumber);
186 return bimp->deleteProperty(exec, prop);
189 bool Reference::isMutable()
static Object create(ExecState *exec, ErrorType errtype=GeneralError, const char *message=0, int lineno=-1, int sourceId=-1)
Factory method for error objects.
Represents the current state of script execution.
Context context() const
Returns the execution context associated with this execution state.
Represents an Identifier for a Javascript object.
bool isNull() const
Returns the identfiers state of being unset.
const UString & ustring() const
returns a UString of the identifier
Represents an primitive Null value.
Value get(ExecState *exec, const Identifier &propertyName) const
Retrieves the specified property from the object.
Defines a Javascript reference.
Identifier getPropertyName(ExecState *exec) const
Performs the GetPropertyName type conversion operation on this value (ECMA 8.7)
Value getBase(ExecState *exec) const
Performs the GetBase type conversion operation on this value (ECMA 8.7)
void putValue(ExecState *exec, const Value &w)
Performs the PutValue type conversion operation on this value (ECMA 8.7.1)
Value getValue(ExecState *exec) const
Performs the GetValue type conversion operation on this value (ECMA 8.7.1)
char * ascii() const
Convert the Unicode string to plain ASCII chars chopping of any higher bytes.
Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents.
bool isValid() const
Returns whether or not this is a valid value.
Type type() const
Returns the type of value.