1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2010 Jay Freeman (saurik)
5 /* GNU Lesser General Public License, Version 3 {{{ */
7 * Cycript is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
12 * Cycript is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with Cycript. If not, see <http://www.gnu.org/licenses/>.
23 #include "Replace.hpp"
27 CYExpression
*CYAdd::Replace(CYContext
&context
) {
28 CYInfix::Replace(context
);
30 CYExpression
*lhp(lhs_
->Primitive(context
));
31 CYExpression
*rhp(rhs_
->Primitive(context
));
33 CYString
*lhs(dynamic_cast<CYString
*>(lhp
));
34 CYString
*rhs(dynamic_cast<CYString
*>(rhp
));
36 if (lhs
!= NULL
|| rhs
!= NULL
) {
38 lhs
= lhp
->String(context
);
41 } else if (rhs
== NULL
) {
42 rhs
= rhp
->String(context
);
47 return lhs
->Concat(context
, rhs
);
50 if (CYNumber
*lhn
= lhp
->Number(context
))
51 if (CYNumber
*rhn
= rhp
->Number(context
))
52 return $
D(lhn
->Value() + rhn
->Value());
57 CYExpression
*CYAddressOf::Replace(CYContext
&context
) {
58 CYPrefix::Replace(context
);
59 return $
C0($
M(rhs_
, $
S("$cya")));
62 void CYArgument::Replace(CYContext
&context
) { $
T()
63 context
.Replace(value_
);
64 next_
->Replace(context
);
67 CYExpression
*CYArray::Replace(CYContext
&context
) {
68 elements_
->Replace(context
);
72 CYExpression
*CYArrayComprehension::Replace(CYContext
&context
) {
73 CYVariable
*cyv($
V("$cyv"));
75 return $
C0($
F(NULL
, $
P1("$cyv", comprehensions_
->Parameters(context
)), $$
->*
76 $
E($
CYAssign(cyv
, $
CYArray()))->*
77 comprehensions_
->Replace(context
, $
E($
C1($
M(cyv
, $
S("push")), expression_
)))->*
82 CYExpression
*CYAssignment::Replace(CYContext
&context
) {
83 context
.Replace(lhs_
);
84 context
.Replace(rhs_
);
88 CYStatement
*CYBlock::Replace(CYContext
&context
) {
89 context
.ReplaceAll(statements_
);
90 if (statements_
== NULL
)
95 CYStatement
*CYBreak::Replace(CYContext
&context
) {
99 CYExpression
*CYCall::AddArgument(CYContext
&context
, CYExpression
*value
) {
100 CYArgument
**argument(&arguments_
);
101 while (*argument
!= NULL
)
102 argument
= &(*argument
)->next_
;
103 *argument
= $
CYArgument(value
);
107 CYExpression
*CYCall::Replace(CYContext
&context
) {
108 context
.Replace(function_
);
109 arguments_
->Replace(context
);
116 void Catch::Replace(CYContext
&context
) { $
T()
117 CYScope
scope(CYScopeCatch
, context
, code_
.statements_
);
119 context
.Replace(name_
);
120 context
.scope_
->Declare(context
, name_
, CYIdentifierCatch
);
122 code_
.Replace(context
);
128 void CYClause::Replace(CYContext
&context
) { $
T()
129 context
.Replace(case_
);
130 context
.ReplaceAll(statements_
);
131 next_
->Replace(context
);
134 CYStatement
*CYComment::Replace(CYContext
&context
) {
138 CYExpression
*CYCompound::Replace(CYContext
&context
) {
139 context
.ReplaceAll(expressions_
);
140 if (expressions_
== NULL
)
145 CYFunctionParameter
*CYComprehension::Parameters(CYContext
&context
) const { $
T(NULL
)
146 CYFunctionParameter
*next(next_
->Parameters(context
));
147 if (CYFunctionParameter
*parameter
= Parameter(context
)) {
148 parameter
->SetNext(next
);
154 CYStatement
*CYComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
155 return next_
== NULL
? statement
: next_
->Replace(context
, statement
);
158 CYExpression
*CYCondition::Replace(CYContext
&context
) {
159 context
.Replace(test_
);
160 context
.Replace(true_
);
161 context
.Replace(false_
);
165 void CYContext::NonLocal(CYStatement
*&statements
) {
166 CYContext
&context(*this);
168 if (nextlocal_
!= NULL
&& nextlocal_
->identifier_
!= NULL
) {
169 CYIdentifier
*cye($
I("$cye")->Replace(context
));
170 CYIdentifier
*unique(nextlocal_
->identifier_
->Replace(context
));
172 CYStatement
*declare(
173 $
CYVar($
L1($
L(unique
, $
CYObject()))));
175 cy::Syntax::Catch
*rescue(
176 $
cy::Syntax::Catch(cye
, $$
->*
177 $
CYIf($
CYIdentical($
M($
V(cye
), $
S("$cyk")), $
V(unique
)), $$
->*
178 $
CYReturn($
M($
V(cye
), $
S("$cyv"))))->*
179 $
cy::Syntax::Throw($
V(cye
))));
181 context
.Replace(declare
);
182 rescue
->Replace(context
);
186 $
cy::Syntax::Try(statements
, rescue
, NULL
);
190 CYIdentifier
*CYContext::Unique() {
191 return $
CYIdentifier(apr_psprintf($pool
, "$cy%u", unique_
++));
194 CYStatement
*CYContinue::Replace(CYContext
&context
) {
198 CYAssignment
*CYDeclaration::Assignment(CYContext
&context
) {
199 context
.Replace(identifier_
);
200 CYExpression
*variable(Replace(context
));
201 context
.scope_
->Declare(context
, identifier_
, CYIdentifierVariable
);
202 return initialiser_
== NULL
? NULL
: $
CYAssign(variable
, initialiser_
);
205 CYStatement
*CYDeclaration::ForEachIn(CYContext
&context
, CYExpression
*value
) {
206 return $
CYVar($
L1($
L(identifier_
, value
)));
209 CYExpression
*CYDeclaration::Replace(CYContext
&context
) {
210 return $
V(identifier_
);
213 CYProperty
*CYDeclarations::Property(CYContext
&context
) { $
T(NULL
)
214 return $
CYProperty(declaration_
->identifier_
, declaration_
->initialiser_
?: $U
, next_
->Property(context
));
217 CYCompound
*CYDeclarations::Replace(CYContext
&context
) {
218 CYCompound
*compound(next_
== NULL
? $
CYCompound() : next_
->Replace(context
));
219 if (CYAssignment
*assignment
= declaration_
->Assignment(context
))
220 compound
->AddPrev(assignment
);
224 CYExpression
*CYDirectMember::Replace(CYContext
&context
) {
229 CYStatement
*CYDoWhile::Replace(CYContext
&context
) {
230 context
.Replace(test_
);
231 context
.Replace(code_
);
235 void CYElement::Replace(CYContext
&context
) { $
T()
236 context
.Replace(value_
);
237 next_
->Replace(context
);
240 CYStatement
*CYEmpty::Replace(CYContext
&context
) {
244 CYStatement
*CYExpress::Replace(CYContext
&context
) {
245 while (CYExpress
*express
= dynamic_cast<CYExpress
*>(next_
)) {
246 CYCompound
*compound(dynamic_cast<CYCompound
*>(express
->expression_
));
247 if (compound
== NULL
)
248 compound
= $
CYCompound(express
->expression_
);
249 compound
->AddPrev(expression_
);
250 expression_
= compound
;
251 SetNext(express
->next_
);
254 context
.Replace(expression_
);
255 if (expression_
== NULL
)
261 CYExpression
*CYExpression::AddArgument(CYContext
&context
, CYExpression
*value
) {
262 return $
C1(this, value
);
265 CYExpression
*CYExpression::ClassName(CYContext
&context
, bool object
) {
269 CYStatement
*CYExpression::ForEachIn(CYContext
&context
, CYExpression
*value
) {
270 return $
E($
CYAssign(this, value
));
273 CYAssignment
*CYExpression::Assignment(CYContext
&context
) {
277 CYNumber
*CYFalse::Number(CYContext
&context
) {
281 CYString
*CYFalse::String(CYContext
&context
) {
285 void CYFinally::Replace(CYContext
&context
) { $
T()
286 code_
.Replace(context
);
289 CYStatement
*CYFor::Replace(CYContext
&context
) {
290 context
.Replace(initialiser_
);
291 context
.Replace(test_
);
292 context
.Replace(increment_
);
293 context
.Replace(code_
);
297 CYStatement
*CYForIn::Replace(CYContext
&context
) {
298 CYAssignment
*assignment(initialiser_
->Assignment(context
));
300 context
.Replace(initialiser_
);
301 context
.Replace(set_
);
302 context
.Replace(code_
);
304 if (assignment
== NULL
)
307 return $
CYBlock($$
->*
313 CYFunctionParameter
*CYForInComprehension::Parameter(CYContext
&context
) const {
314 return $
CYFunctionParameter(name_
);
317 CYStatement
*CYForInComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
318 return $
CYForIn($
V(name_
), set_
, CYComprehension::Replace(context
, statement
));
321 CYStatement
*CYForEachIn::Replace(CYContext
&context
) {
322 CYIdentifier
*cys($
I("$cys")), *cyt($
I("$cyt"));
324 return $
CYLet($
L2($
L(cys
, set_
), $
L(cyt
)), $$
->*
325 $
CYForIn($
V(cyt
), $
V(cys
), $
CYBlock($$
->*
326 initialiser_
->ForEachIn(context
, $
M($
V(cys
), $
V(cyt
)))->*
332 CYFunctionParameter
*CYForEachInComprehension::Parameter(CYContext
&context
) const {
333 return $
CYFunctionParameter(name_
);
336 CYStatement
*CYForEachInComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
337 CYIdentifier
*cys($
I("cys"));
339 return $
E($
C0($
F(NULL
, $
P1("$cys"), $$
->*
340 $
E($
CYAssign($
V(cys
), set_
))->*
341 $
CYForIn($
V(name_
), $
V(cys
), $
CYBlock($$
->*
342 $
E($
CYAssign($
V(name_
), $
M($
V(cys
), $
V(name_
))))->*
343 CYComprehension::Replace(context
, statement
)
348 void CYFunction::Inject(CYContext
&context
) {
349 context
.Replace(name_
);
350 context
.scope_
->Declare(context
, name_
, CYIdentifierOther
);
353 void CYFunction::Replace_(CYContext
&context
, bool outer
) {
357 CYScope
scope(CYScopeFunction
, context
, code_
.statements_
);
359 CYNonLocal
*nonlocal(context
.nonlocal_
);
360 CYNonLocal
*nextlocal(context
.nextlocal_
);
363 if (nonlocal_
!= NULL
) {
365 context
.nonlocal_
= nonlocal_
;
368 nonlocal_
= $
CYNonLocal();
369 context
.nextlocal_
= nonlocal_
;
372 if (!outer
&& name_
!= NULL
)
375 if (parameters_
!= NULL
)
376 parameters_
= parameters_
->Replace(context
, code_
);
378 code_
.Replace(context
);
381 context
.NonLocal(code_
.statements_
);
383 context
.nextlocal_
= nextlocal
;
384 context
.nonlocal_
= nonlocal
;
389 CYExpression
*CYFunctionExpression::Replace(CYContext
&context
) {
390 Replace_(context
, false);
394 CYFunctionParameter
*CYFunctionParameter::Replace(CYContext
&context
, CYBlock
&code
) {
395 context
.Replace(name_
);
396 context
.scope_
->Declare(context
, name_
, CYIdentifierArgument
);
398 next_
= next_
->Replace(context
, code
);
402 CYStatement
*CYFunctionStatement::Replace(CYContext
&context
) {
403 Replace_(context
, true);
407 CYIdentifier
*CYIdentifier::Replace(CYContext
&context
) {
408 if (replace_
!= NULL
&& replace_
!= this)
409 return replace_
->Replace(context
);
410 replace_
= context
.scope_
->Lookup(context
, this);
414 CYStatement
*CYIf::Replace(CYContext
&context
) {
415 context
.Replace(test_
);
416 context
.Replace(true_
);
417 context
.Replace(false_
);
421 CYFunctionParameter
*CYIfComprehension::Parameter(CYContext
&context
) const {
425 CYStatement
*CYIfComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
426 return $
CYIf(test_
, CYComprehension::Replace(context
, statement
));
429 CYExpression
*CYIndirect::Replace(CYContext
&context
) {
430 CYPrefix::Replace(context
);
431 return $
M(rhs_
, $
S("$cyi"));
434 CYExpression
*CYIndirectMember::Replace(CYContext
&context
) {
436 return $
M($
CYIndirect(object_
), property_
);
439 CYExpression
*CYInfix::Replace(CYContext
&context
) {
440 context
.Replace(lhs_
);
441 context
.Replace(rhs_
);
445 CYStatement
*CYLabel::Replace(CYContext
&context
) {
446 context
.Replace(statement_
);
450 CYStatement
*CYLet::Replace(CYContext
&context
) {
451 return $
CYWith($
CYObject(declarations_
->Property(context
)), &code_
);
454 void CYMember::Replace_(CYContext
&context
) {
455 context
.Replace(object_
);
456 context
.Replace(property_
);
462 CYExpression
*New::AddArgument(CYContext
&context
, CYExpression
*value
) {
463 CYSetLast(arguments_
, $
CYArgument(value
));
467 CYExpression
*New::Replace(CYContext
&context
) {
468 context
.Replace(constructor_
);
469 arguments_
->Replace(context
);
475 CYNumber
*CYNull::Number(CYContext
&context
) {
479 CYString
*CYNull::String(CYContext
&context
) {
483 CYNumber
*CYNumber::Number(CYContext
&context
) {
487 CYString
*CYNumber::String(CYContext
&context
) {
488 // XXX: there is a precise algorithm for this
489 return $
S(apr_psprintf($pool
, "%.17g", Value()));
492 CYExpression
*CYObject::Replace(CYContext
&context
) {
493 properties_
->Replace(context
);
497 CYFunctionParameter
*CYOptionalFunctionParameter::Replace(CYContext
&context
, CYBlock
&code
) {
498 CYFunctionParameter
*parameter($
CYFunctionParameter(name_
, next_
));
499 parameter
= parameter
->Replace(context
, code
);
500 context
.Replace(initializer_
);
502 CYVariable
*name($
V(name_
));
503 code
.AddPrev($
CYIf($
CYIdentical($
CYTypeOf(name
), $
S("undefined")), $$
->*
504 $
E($
CYAssign(name
, initializer_
))
510 CYExpression
*CYPostfix::Replace(CYContext
&context
) {
511 context
.Replace(lhs_
);
515 CYExpression
*CYPrefix::Replace(CYContext
&context
) {
516 context
.Replace(rhs_
);
520 // XXX: this is evil evil black magic. don't ask, don't tell... don't believe!
521 #define MappingSet "0etnirsoalfucdphmgyvbxTwSNECAFjDLkMOIBPqzRH$_WXUVGYKQJZ"
522 //#define MappingSet "0abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"
525 struct IdentifierUsageLess
:
526 std::binary_function
<CYIdentifier
*, CYIdentifier
*, bool>
528 _finline
bool operator ()(CYIdentifier
*lhs
, CYIdentifier
*rhs
) const {
529 if (lhs
->usage_
!= rhs
->usage_
)
530 return lhs
->usage_
> rhs
->usage_
;
535 typedef std::set
<CYIdentifier
*, IdentifierUsageLess
> IdentifierUsages
;
538 void CYProgram::Replace(CYContext
&context
) {
539 CYScope
scope(CYScopeProgram
, context
, statements_
);
541 context
.nextlocal_
= $
CYNonLocal();
542 context
.ReplaceAll(statements_
);
543 context
.NonLocal(statements_
);
549 CYCStringSet external
;
550 for (CYIdentifierValueSet::const_iterator
i(scope
.identifiers_
.begin()); i
!= scope
.identifiers_
.end(); ++i
)
551 external
.insert((*i
)->Word());
553 IdentifierUsages usages
;
555 if (offset
< context
.rename_
.size())
556 CYForEach (i
, context
.rename_
[offset
].identifier_
)
559 // XXX: totalling the probable occurrences and sorting by them would improve the result
560 for (CYIdentifierUsageVector::const_iterator
i(context
.rename_
.begin()); i
!= context
.rename_
.end(); ++i
, ++offset
) {
561 //std::cout << *i << ":" << (*i)->offset_ << std::endl;
565 if (context
.options_
.verbose_
)
566 name
= apr_psprintf($pool
, "$%"APR_SIZE_T_FMT
"", offset
);
572 unsigned position(7), local(offset
+ 1);
575 unsigned index(local
% (sizeof(MappingSet
) - 1));
576 local
/= sizeof(MappingSet
) - 1;
577 id
[--position
] = MappingSet
[index
];
578 } while (local
!= 0);
580 if (external
.find(id
+ position
) != external
.end()) {
585 name
= apr_pstrmemdup($pool
, id
+ position
, 7 - position
);
586 // XXX: at some point, this could become a keyword
589 CYForEach (identifier
, i
->identifier_
)
590 identifier
->Set(name
);
594 void CYProperty::Replace(CYContext
&context
) { $
T()
595 context
.Replace(value_
);
596 next_
->Replace(context
);
599 CYStatement
*CYReturn::Replace(CYContext
&context
) {
600 if (context
.nonlocal_
!= NULL
) {
601 CYProperty
*value(value_
== NULL
? NULL
: $
CYProperty($
S("$cyv"), value_
));
602 return $
cy::Syntax::Throw($
CYObject(
603 $
CYProperty($
S("$cyk"), $
V(context
.nonlocal_
->Target(context
)), value
)
607 context
.Replace(value_
);
611 CYExpression
*CYRubyBlock::Replace(CYContext
&context
) {
612 // XXX: this needs to do something much more epic to handle return
613 return call_
->AddArgument(context
, proc_
->Replace(context
));
616 CYExpression
*CYRubyProc::Replace(CYContext
&context
) {
617 CYFunctionExpression
*function($
CYFunctionExpression(NULL
, parameters_
, code_
));
618 function
->nonlocal_
= context
.nextlocal_
;
622 CYScope::CYScope(CYScopeType type
, CYContext
&context
, CYStatement
*&statements
) :
625 statements_(statements
),
626 parent_(context
.scope_
)
628 context_
.scope_
= this;
631 CYScope::~CYScope() {
634 void CYScope::Close() {
635 context_
.scope_
= parent_
;
636 Scope(context_
, statements_
);
639 void CYScope::Declare(CYContext
&context
, CYIdentifier
*identifier
, CYIdentifierFlags flags
) {
640 if (type_
== CYScopeCatch
&& flags
!= CYIdentifierCatch
)
641 parent_
->Declare(context
, identifier
, flags
);
643 internal_
.insert(CYIdentifierAddressFlagsMap::value_type(identifier
, flags
));
646 CYIdentifier
*CYScope::Lookup(CYContext
&context
, CYIdentifier
*identifier
) {
647 std::pair
<CYIdentifierValueSet::iterator
, bool> insert(identifiers_
.insert(identifier
));
648 return *insert
.first
;
651 void CYScope::Merge(CYContext
&context
, CYIdentifier
*identifier
) {
652 std::pair
<CYIdentifierValueSet::iterator
, bool> insert(identifiers_
.insert(identifier
));
653 if (!insert
.second
) {
654 if ((*insert
.first
)->offset_
< identifier
->offset_
)
655 (*insert
.first
)->offset_
= identifier
->offset_
;
656 identifier
->replace_
= *insert
.first
;
657 (*insert
.first
)->usage_
+= identifier
->usage_
+ 1;
662 struct IdentifierOffset
{
664 CYIdentifierFlags flags_
;
666 CYIdentifier
*identifier_
;
668 IdentifierOffset(CYIdentifier
*identifier
, CYIdentifierFlags flags
) :
669 offset_(identifier
->offset_
),
671 usage_(identifier
->usage_
),
672 identifier_(identifier
)
677 struct IdentifierOffsetLess
:
678 std::binary_function
<const IdentifierOffset
&, const IdentifierOffset
&, bool>
680 _finline
bool operator ()(const IdentifierOffset
&lhs
, const IdentifierOffset
&rhs
) const {
681 if (lhs
.offset_
!= rhs
.offset_
)
682 return lhs
.offset_
< rhs
.offset_
;
683 if (lhs
.flags_
!= rhs
.flags_
)
684 return lhs
.flags_
< rhs
.flags_
;
685 /*if (lhs.usage_ != rhs.usage_)
686 return lhs.usage_ < rhs.usage_;*/
687 return lhs
.identifier_
< rhs
.identifier_
;
691 typedef std::set
<IdentifierOffset
, IdentifierOffsetLess
> IdentifierOffsets
;
694 void CYScope::Scope(CYContext
&context
, CYStatement
*&statements
) {
698 CYDeclarations
*last(NULL
), *curr(NULL
);
700 IdentifierOffsets offsets
;
702 for (CYIdentifierAddressFlagsMap::const_iterator
i(internal_
.begin()); i
!= internal_
.end(); ++i
)
703 if (i
->second
!= CYIdentifierMagic
)
704 offsets
.insert(IdentifierOffset(i
->first
, i
->second
));
708 for (IdentifierOffsets::const_iterator
i(offsets
.begin()); i
!= offsets
.end(); ++i
) {
709 if (i
->flags_
== CYIdentifierVariable
) {
710 CYDeclarations
*next($
CYDeclarations($
CYDeclaration(i
->identifier_
)));
718 if (offset
< i
->offset_
)
720 if (context
.rename_
.size() <= offset
)
721 context
.rename_
.resize(offset
+ 1);
723 CYIdentifierUsage
&rename(context
.rename_
[offset
++]);
724 i
->identifier_
->SetNext(rename
.identifier_
);
725 rename
.identifier_
= i
->identifier_
;
726 rename
.usage_
+= i
->identifier_
->usage_
+ 1;
730 CYVar
*var($
CYVar(last
));
731 var
->SetNext(statements
);
735 for (CYIdentifierValueSet::const_iterator
i(identifiers_
.begin()); i
!= identifiers_
.end(); ++i
)
736 if (internal_
.find(*i
) == internal_
.end()) {
737 //std::cout << *i << '=' << offset << std::endl;
738 if ((*i
)->offset_
< offset
)
739 (*i
)->offset_
= offset
;
740 parent_
->Merge(context
, *i
);
744 CYString
*CYString::Concat(CYContext
&context
, CYString
*rhs
) const {
745 size_t size(size_
+ rhs
->size_
);
746 char *value($
char[size
+ 1]);
747 memcpy(value
, value_
, size_
);
748 memcpy(value
+ size_
, rhs
->value_
, rhs
->size_
);
750 return $
S(value
, size
);
753 CYNumber
*CYString::Number(CYContext
&context
) {
754 // XXX: there is a precise algorithm for this
758 CYString
*CYString::String(CYContext
&context
) {
762 CYStatement
*CYSwitch::Replace(CYContext
&context
) {
763 context
.Replace(value_
);
764 clauses_
->Replace(context
);
768 CYExpression
*CYThis::Replace(CYContext
&context
) {
775 CYStatement
*Throw::Replace(CYContext
&context
) {
776 context
.Replace(value_
);
782 CYExpression
*CYTrivial::Replace(CYContext
&context
) {
786 CYNumber
*CYTrue::Number(CYContext
&context
) {
790 CYString
*CYTrue::String(CYContext
&context
) {
797 CYStatement
*Try::Replace(CYContext
&context
) {
798 code_
.Replace(context
);
799 catch_
->Replace(context
);
800 finally_
->Replace(context
);
806 CYStatement
*CYVar::Replace(CYContext
&context
) {
807 return $
E(declarations_
->Replace(context
));
810 CYExpression
*CYVariable::Replace(CYContext
&context
) {
811 context
.Replace(name_
);
815 CYStatement
*CYWhile::Replace(CYContext
&context
) {
816 context
.Replace(test_
);
817 context
.Replace(code_
);
821 CYStatement
*CYWith::Replace(CYContext
&context
) {
822 context
.Replace(scope_
);
823 context
.Replace(code_
);
827 CYExpression
*CYWord::ClassName(CYContext
&context
, bool object
) {
828 CYString
*name($
S(this));
830 return $
C1($
V("objc_getClass"), name
);