Changeset 543
- Timestamp:
- 06/06/08 10:54:03 (7 months ago)
- Location:
- trunk/pcc
- Files:
-
- 3 modified
-
compiler/evaluate.scm (modified) (1 diff)
-
compiler/generate.scm (modified) (2 diffs)
-
runtime/php-object.scm (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pcc/compiler/evaluate.scm
r541 r543 873 873 ; always return null 874 874 NULL) 875 ; normal unset876 ( %unset-eval-assign lval)))))875 ; unset (remove) property 876 (php-object-property-unset obj-e prop-e))))) 877 877 878 878 (define-method (unset lval::hash-lookup) -
trunk/pcc/compiler/generate.scm
r541 r543 1788 1788 (php-object-class obj-evald) 1789 1789 "__unset") 1790 ; we call __ isset when the caller doesn't have visibility access1790 ; we call __unset when the caller doesn't have visibility access 1791 1791 ; (whether it's actually declared for real or not) or when it 1792 1792 ; would have visibility but it's not declared … … 1796 1796 ,the-property)))) 1797 1797 (convert-to-boolean (call-php-method-1 obj-evald "__unset" ,the-property)) 1798 ; normal isset1799 ,(update-value lval ''()))))))1798 ; unset (remove) property 1799 (php-object-property-unset obj-evald ,the-property)))))) 1800 1800 1801 1801 ;;;;isset -
trunk/pcc/runtime/php-object.scm
r514 r543 64 64 (php-class-props class-name) 65 65 (php-object-has-declared-property? obj::struct property::bstring) 66 (php-object-property-unset obj::struct property::bstring) 66 67 (php-object-property/index obj::struct property::int property-name) 67 68 (php-object-property/string obj property::bstring access-type) … … 295 296 (prop-key (hashtable-get offsets-table i))) 296 297 ; if it's not in offsets table, it's a static and we skip it 297 (when prop-key298 (when (and prop-key (not (eqv? prop-value 'prop-unset))) 298 299 (php-hash-insert! property-hash 299 300 prop-key … … 322 323 ; (fprint (current-error-port) "ref-status is " (mkstr (container-reference? prop-value))) 323 324 ; if we don't have prop key, it's a static and we skip it 324 (when prop-key325 (when (and prop-key (not (eqv? prop-value 'prop-unset))) 325 326 (thunk ;note the reverse lookup to get the name 326 327 (mkstr prop-key) … … 349 350 (prop-key (hashtable-get offsets-table i))) 350 351 ; if it's not in offsets table, it's a static and we skip it 351 (when prop-key352 (when (and prop-key (not (eqv? prop-value 'prop-unset))) 352 353 (php-hash-insert! property-hash 353 354 ;note the reverse lookup to get the name … … 586 587 (%property-name-canonicalize property-name)) 587 588 property)) 589 590 ; XXX check for 'prop-unset ? 588 591 (vector-ref (%php-object-properties obj) property) 589 592 … … 1543 1546 ;;;;the actual property looker-uppers 1544 1547 1548 (define (php-object-property-unset obj::struct property::bstring) 1549 "remove the property from the object, only available via unset()" 1550 (if (php-object? obj) 1551 (let* ((canon-name (%property-name-canonicalize property)) 1552 (offset (%prop-offset obj canon-name 'all))) 1553 ; first check declared 1554 (when offset 1555 ; we can't remove it since the classes offset hash will still point 1556 ; here (and needs to for other instances) so we set it to a special value 1557 (vector-set! (%php-object-properties obj) offset 'prop-unset)) 1558 ; check extended 1559 (when (php-hash-contains? (%php-object-extended-properties obj) canon-name) 1560 (php-hash-remove! (%php-object-extended-properties obj) canon-name)) 1561 NULL))) 1562 1545 1563 (define (php-object-has-declared-property? obj::struct property::bstring) 1546 1564 "see if the object has the specified declared property, regardless of visibility" … … 1556 1574 (if offset 1557 1575 ; declared 1558 (vector-ref (%php-object-properties obj) offset) 1576 (let ((val (vector-ref (%php-object-properties obj) offset))) 1577 (if (eqv? val 'prop-unset) 1578 NULL 1579 val)) 1559 1580 ; not declared. maybe use __get 1560 1581 (let ((get-method (%lookup-method (%php-object-class obj) "__get"))) … … 1573 1594 (if offset 1574 1595 ; declared 1575 (container-value (vector-ref (%php-object-properties obj) offset)) 1596 (let ((val (vector-ref (%php-object-properties obj) offset))) 1597 (if (eqv? val 'prop-unset) 1598 NULL 1599 (container-value val))) 1576 1600 ; not declared. maybe use __get 1577 1601 (let ((get-method (%lookup-method (%php-object-class obj) "__get")))
