Changeset 1859 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Aug 18, 2002, 12:21:26 AM (23 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r1799 r1859 417 417 delete progNode; 418 418 if (c.complType() == ReturnValue) 419 return c ;419 return c.value(); 420 420 // ### setException() on throw? 421 421 else if (c.complType() == Normal) { … … 425 425 return Undefined(); 426 426 } else { 427 return c;427 return Undefined(); 428 428 } 429 429 } -
trunk/JavaScriptCore/kjs/internal.cpp
r1850 r1859 330 330 tos = prev; 331 331 } 332 }333 334 // ------------------------------ CompletionImp --------------------------------335 336 CompletionImp::CompletionImp(ComplType c, const Value& v, const UString& t)337 : comp(c), val(v.imp()), tar(t)338 {339 }340 341 CompletionImp::~CompletionImp()342 {343 }344 345 void CompletionImp::mark()346 {347 ValueImp::mark();348 349 if (val && !val->marked())350 val->mark();351 }352 353 Value CompletionImp::toPrimitive(ExecState */*exec*/, Type /*preferredType*/) const354 {355 // invalid for Completion356 assert(false);357 return Value();358 }359 360 bool CompletionImp::toBoolean(ExecState */*exec*/) const361 {362 // invalid for Completion363 assert(false);364 return false;365 }366 367 double CompletionImp::toNumber(ExecState */*exec*/) const368 {369 // invalid for Completion370 assert(false);371 return 0;372 }373 374 UString CompletionImp::toString(ExecState */*exec*/) const375 {376 // invalid for Completion377 assert(false);378 return UString::null;379 }380 381 Object CompletionImp::toObject(ExecState */*exec*/) const382 {383 // invalid for Completion384 assert(false);385 return Object();386 332 } 387 333 -
trunk/JavaScriptCore/kjs/internal.h
r1850 r1859 143 143 // --------------------------------------------------------------------------- 144 144 145 class CompletionImp : public ValueImp {146 public:147 Type type() const { return CompletionType; }148 149 CompletionImp(ComplType c, const Value& v, const UString& t);150 virtual ~CompletionImp();151 virtual void mark();152 153 Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;154 bool toBoolean(ExecState *exec) const;155 double toNumber(ExecState *exec) const;156 UString toString(ExecState *exec) const;157 Object toObject(ExecState *exec) const;158 159 ComplType complType() const { return comp; }160 Value value() const { return Value(val); }161 UString target() const { return tar; }162 163 private:164 ComplType comp;165 ValueImp * val;166 UString tar;167 };168 169 inline Completion::Completion(CompletionImp *imp) : Value(imp) { }170 171 145 /** 172 146 * @internal -
trunk/JavaScriptCore/kjs/types.cpp
r1841 r1859 204 204 #endif 205 205 206 207 // ------------------------------ Completion -----------------------------------208 209 Completion::Completion(ComplType c, const Value& v, const UString &t)210 : Value(new CompletionImp(c,v,t))211 {212 }213 214 Completion Completion::dynamicCast(const Value &v)215 {216 if (v.isNull() || v.type() != CompletionType)217 return 0;218 219 return static_cast<CompletionImp*>(v.imp());220 }221 222 ComplType Completion::complType() const223 {224 return static_cast<CompletionImp*>(rep)->complType();225 }226 227 Value Completion::value() const228 {229 return static_cast<CompletionImp*>(rep)->value();230 }231 232 UString Completion::target() const233 {234 return static_cast<CompletionImp*>(rep)->target();235 }236 237 bool Completion::isValueCompletion() const238 {239 return !value().isNull();240 } -
trunk/JavaScriptCore/kjs/types.h
r1841 r1859 28 28 29 29 #include "value.h" 30 #include "reference.h" 31 #include "completion.h" 30 32 31 33 namespace KJS { … … 200 202 }; 201 203 202 /**203 * Completion types.204 */205 enum ComplType { Normal, Break, Continue, ReturnValue, Throw };206 207 /**208 * Completion objects are used to convey the return status and value209 * from functions.210 *211 * See @ref FunctionImp::execute()212 *213 * @see FunctionImp214 *215 * @short Handle for a Completion type.216 */217 class Completion : public Value {218 public:219 Completion(ComplType c = Normal, const Value& v = Value(),220 const UString &t = UString::null);221 Completion(CompletionImp *v);222 223 /**224 * Converts a Value into an Completion. If the value's type is not225 * CompletionType, a null object will be returned (i.e. one with it's226 * internal pointer set to 0). If you do not know for sure whether the227 * value is of type CompletionType, you should check the @ref isNull()228 * methods afterwards before calling any methods on the returned value.229 *230 * @return The value converted to an Completion231 */232 static Completion dynamicCast(const Value &v);233 234 ComplType complType() const;235 Value value() const;236 UString target() const;237 bool isValueCompletion() const;238 };239 240 204 }; // namespace 241 205
Note:
See TracChangeset
for help on using the changeset viewer.