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_
);
143 CYFunctionParameter
*CYComprehension::Parameters(CYContext
&context
) const { $
T(NULL
)
144 CYFunctionParameter
*next(next_
->Parameters(context
));
145 if (CYFunctionParameter
*parameter
= Parameter(context
)) {
146 parameter
->SetNext(next
);
152 CYStatement
*CYComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
153 return next_
== NULL
? statement
: next_
->Replace(context
, statement
);
156 CYExpression
*CYCondition::Replace(CYContext
&context
) {
157 context
.Replace(test_
);
158 context
.Replace(true_
);
159 context
.Replace(false_
);
163 void CYContext::NonLocal(CYStatement
*&statements
) {
164 CYContext
&context(*this);
166 if (nextlocal_
!= NULL
&& nextlocal_
->identifier_
!= NULL
) {
167 CYIdentifier
*cye($
I("$cye")->Replace(context
));
168 CYIdentifier
*unique(nextlocal_
->identifier_
->Replace(context
));
170 CYStatement
*declare(
171 $
CYVar($
L1($
L(unique
, $
CYObject()))));
173 cy::Syntax::Catch
*rescue(
174 $
cy::Syntax::Catch(cye
, $$
->*
175 $
CYIf($
CYIdentical($
M($
V(cye
), $
S("$cyk")), $
V(unique
)), $$
->*
176 $
CYReturn($
M($
V(cye
), $
S("$cyv"))))->*
177 $
cy::Syntax::Throw($
V(cye
))));
179 context
.Replace(declare
);
180 rescue
->Replace(context
);
184 $
cy::Syntax::Try(statements
, rescue
, NULL
);
188 CYIdentifier
*CYContext::Unique() {
189 return $
CYIdentifier(apr_psprintf($pool
, "$cy%u", unique_
++));
192 CYStatement
*CYContinue::Replace(CYContext
&context
) {
196 CYAssignment
*CYDeclaration::Assignment(CYContext
&context
) {
197 CYExpression
*variable(Replace(context
));
198 return initialiser_
== NULL
? NULL
: $
CYAssign(variable
, initialiser_
);
201 CYExpression
*CYDeclaration::ForEachIn(CYContext
&context
) {
202 return $
V(identifier_
);
205 CYExpression
*CYDeclaration::Replace(CYContext
&context
) {
206 context
.Replace(identifier_
);
207 context
.scope_
->Declare(context
, identifier_
, CYIdentifierVariable
);
208 return $
V(identifier_
);
211 CYProperty
*CYDeclarations::Property(CYContext
&context
) { $
T(NULL
)
212 return $
CYProperty(declaration_
->identifier_
, declaration_
->initialiser_
?: $U
, next_
->Property(context
));
215 CYCompound
*CYDeclarations::Replace(CYContext
&context
) {
216 CYCompound
*compound(next_
== NULL
? $
CYCompound() : next_
->Replace(context
));
217 if (CYAssignment
*assignment
= declaration_
->Assignment(context
))
218 compound
->AddPrev(assignment
);
222 CYExpression
*CYDirectMember::Replace(CYContext
&context
) {
227 CYStatement
*CYDoWhile::Replace(CYContext
&context
) {
228 context
.Replace(test_
);
229 context
.Replace(code_
);
233 void CYElement::Replace(CYContext
&context
) { $
T()
234 context
.Replace(value_
);
235 next_
->Replace(context
);
238 CYStatement
*CYEmpty::Collapse(CYContext
&context
) {
242 CYStatement
*CYEmpty::Replace(CYContext
&context
) {
246 CYStatement
*CYExpress::Collapse(CYContext
&context
) {
247 if (CYExpress
*express
= dynamic_cast<CYExpress
*>(next_
)) {
248 CYCompound
*next(dynamic_cast<CYCompound
*>(express
->expression_
));
250 next
= $
CYCompound(express
->expression_
);
251 next
->AddPrev(expression_
);
253 SetNext(express
->next_
);
259 CYStatement
*CYExpress::Replace(CYContext
&context
) {
260 context
.Replace(expression_
);
261 if (expression_
== NULL
)
266 CYExpression
*CYExpression::AddArgument(CYContext
&context
, CYExpression
*value
) {
267 return $
C1(this, value
);
270 CYExpression
*CYExpression::ClassName(CYContext
&context
, bool object
) {
274 CYExpression
*CYExpression::ForEachIn(CYContext
&context
) {
278 CYNumber
*CYFalse::Number(CYContext
&context
) {
282 CYString
*CYFalse::String(CYContext
&context
) {
286 void CYFinally::Replace(CYContext
&context
) { $
T()
287 code_
.Replace(context
);
290 CYStatement
*CYFor::Replace(CYContext
&context
) {
291 context
.Replace(initialiser_
);
292 context
.Replace(test_
);
293 context
.Replace(increment_
);
294 context
.Replace(code_
);
298 CYStatement
*CYForIn::Replace(CYContext
&context
) {
299 // XXX: this actually might need a prefix statement
300 context
.Replace(initialiser_
);
301 context
.Replace(set_
);
302 context
.Replace(code_
);
306 CYFunctionParameter
*CYForInComprehension::Parameter(CYContext
&context
) const {
307 return $
CYFunctionParameter(name_
);
310 CYStatement
*CYForInComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
311 return $
CYForIn($
V(name_
), set_
, CYComprehension::Replace(context
, statement
));
314 CYStatement
*CYForEachIn::Replace(CYContext
&context
) {
315 CYIdentifier
*cys($
I("$cys")), *cyt($
I("$cyt"));
317 return $
CYLet($
L2($
L(cys
, set_
), $
L(cyt
)), $$
->*
318 $
CYForIn($
V(cyt
), $
V(cys
), $
CYBlock($$
->*
319 $
E($
CYAssign(initialiser_
->ForEachIn(context
), $
M($
V(cys
), $
V(cyt
))))->*
325 CYFunctionParameter
*CYForEachInComprehension::Parameter(CYContext
&context
) const {
326 return $
CYFunctionParameter(name_
);
329 CYStatement
*CYForEachInComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
330 CYIdentifier
*cys($
I("cys"));
332 return $
E($
C0($
F(NULL
, $
P1("$cys"), $$
->*
333 $
E($
CYAssign($
V(cys
), set_
))->*
334 $
CYForIn($
V(name_
), $
V(cys
), $
CYBlock($$
->*
335 $
E($
CYAssign($
V(name_
), $
M($
V(cys
), $
V(name_
))))->*
336 CYComprehension::Replace(context
, statement
)
341 void CYFunction::Inject(CYContext
&context
) {
342 context
.Replace(name_
);
343 context
.scope_
->Declare(context
, name_
, CYIdentifierOther
);
346 void CYFunction::Replace_(CYContext
&context
, bool outer
) {
350 CYScope
scope(CYScopeFunction
, context
, code_
.statements_
);
352 CYNonLocal
*nonlocal(context
.nonlocal_
);
353 CYNonLocal
*nextlocal(context
.nextlocal_
);
356 if (nonlocal_
!= NULL
) {
358 context
.nonlocal_
= nonlocal_
;
361 nonlocal_
= $
CYNonLocal();
362 context
.nextlocal_
= nonlocal_
;
365 if (!outer
&& name_
!= NULL
)
368 if (parameters_
!= NULL
)
369 parameters_
= parameters_
->Replace(context
, code_
);
371 code_
.Replace(context
);
374 context
.NonLocal(code_
.statements_
);
376 context
.nextlocal_
= nextlocal
;
377 context
.nonlocal_
= nonlocal
;
382 CYExpression
*CYFunctionExpression::Replace(CYContext
&context
) {
383 Replace_(context
, false);
387 CYFunctionParameter
*CYFunctionParameter::Replace(CYContext
&context
, CYBlock
&code
) {
388 context
.Replace(name_
);
389 context
.scope_
->Declare(context
, name_
, CYIdentifierArgument
);
391 next_
= next_
->Replace(context
, code
);
395 CYStatement
*CYFunctionStatement::Replace(CYContext
&context
) {
396 Replace_(context
, true);
400 CYIdentifier
*CYIdentifier::Replace(CYContext
&context
) {
401 if (replace_
!= NULL
&& replace_
!= this)
402 return replace_
->Replace(context
);
403 replace_
= context
.scope_
->Lookup(context
, this);
407 CYStatement
*CYIf::Replace(CYContext
&context
) {
408 context
.Replace(test_
);
409 context
.Replace(true_
);
410 context
.Replace(false_
);
414 CYFunctionParameter
*CYIfComprehension::Parameter(CYContext
&context
) const {
418 CYStatement
*CYIfComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
419 return $
CYIf(test_
, CYComprehension::Replace(context
, statement
));
422 CYExpression
*CYIndirect::Replace(CYContext
&context
) {
423 CYPrefix::Replace(context
);
424 return $
M(rhs_
, $
S("$cyi"));
427 CYExpression
*CYIndirectMember::Replace(CYContext
&context
) {
429 return $
M($
CYIndirect(object_
), property_
);
432 CYExpression
*CYInfix::Replace(CYContext
&context
) {
433 context
.Replace(lhs_
);
434 context
.Replace(rhs_
);
438 CYStatement
*CYLabel::Replace(CYContext
&context
) {
439 context
.Replace(statement_
);
443 CYStatement
*CYLet::Replace(CYContext
&context
) {
444 return $
CYWith($
CYObject(declarations_
->Property(context
)), &code_
);
447 void CYMember::Replace_(CYContext
&context
) {
448 context
.Replace(object_
);
449 context
.Replace(property_
);
455 CYExpression
*New::AddArgument(CYContext
&context
, CYExpression
*value
) {
456 CYArgument
**argument(&arguments_
);
457 while (*argument
!= NULL
)
458 argument
= &(*argument
)->next_
;
459 *argument
= $
CYArgument(value
);
463 CYExpression
*New::Replace(CYContext
&context
) {
464 context
.Replace(constructor_
);
465 arguments_
->Replace(context
);
471 CYNumber
*CYNull::Number(CYContext
&context
) {
475 CYString
*CYNull::String(CYContext
&context
) {
479 CYNumber
*CYNumber::Number(CYContext
&context
) {
483 CYString
*CYNumber::String(CYContext
&context
) {
484 // XXX: there is a precise algorithm for this
485 return $
S(apr_psprintf($pool
, "%.17g", Value()));
488 CYExpression
*CYObject::Replace(CYContext
&context
) {
489 properties_
->Replace(context
);
493 CYFunctionParameter
*CYOptionalFunctionParameter::Replace(CYContext
&context
, CYBlock
&code
) {
494 CYFunctionParameter
*parameter($
CYFunctionParameter(name_
, next_
));
495 parameter
= parameter
->Replace(context
, code
);
496 context
.Replace(initializer_
);
498 CYVariable
*name($
V(name_
));
499 code
.AddPrev($
CYIf($
CYIdentical($
CYTypeOf(name
), $
S("undefined")), $$
->*
500 $
E($
CYAssign(name
, initializer_
))
506 CYExpression
*CYPostfix::Replace(CYContext
&context
) {
507 context
.Replace(lhs_
);
511 CYExpression
*CYPrefix::Replace(CYContext
&context
) {
512 context
.Replace(rhs_
);
516 // XXX: this is evil evil black magic. don't ask, don't tell... don't believe!
517 #define MappingSet "0etnirsoalfucdphmgyvbxTwSNECAFjDLkMOIBPqzRH$_WXUVGYKQJZ"
518 //#define MappingSet "0abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"
521 struct IdentifierUsageLess
:
522 std::binary_function
<CYIdentifier
*, CYIdentifier
*, bool>
524 _finline
bool operator ()(CYIdentifier
*lhs
, CYIdentifier
*rhs
) const {
525 if (lhs
->usage_
!= rhs
->usage_
)
526 return lhs
->usage_
> rhs
->usage_
;
531 typedef std::set
<CYIdentifier
*, IdentifierUsageLess
> IdentifierUsages
;
534 void CYProgram::Replace(CYContext
&context
) {
535 CYScope
scope(CYScopeProgram
, context
, statements_
);
537 context
.nextlocal_
= $
CYNonLocal();
538 context
.ReplaceAll(statements_
);
539 context
.NonLocal(statements_
);
545 CYCStringSet external
;
546 for (CYIdentifierValueSet::const_iterator
i(scope
.identifiers_
.begin()); i
!= scope
.identifiers_
.end(); ++i
)
547 external
.insert((*i
)->Word());
549 IdentifierUsages usages
;
551 if (offset
< context
.rename_
.size())
552 for (CYIdentifier
*i(context
.rename_
[offset
].identifier_
); i
!= NULL
; i
= i
->next_
)
555 // XXX: totalling the probable occurrences and sorting by them would improve the result
556 for (CYIdentifierUsageVector::const_iterator
i(context
.rename_
.begin()); i
!= context
.rename_
.end(); ++i
, ++offset
) {
557 //std::cout << *i << ":" << (*i)->offset_ << std::endl;
561 if (context
.options_
.verbose_
)
562 name
= apr_psprintf($pool
, "$%"APR_SIZE_T_FMT
"", offset
);
568 unsigned position(7), local(offset
+ 1);
571 unsigned index(local
% (sizeof(MappingSet
) - 1));
572 local
/= sizeof(MappingSet
) - 1;
573 id
[--position
] = MappingSet
[index
];
574 } while (local
!= 0);
576 if (external
.find(id
+ position
) != external
.end()) {
581 name
= apr_pstrmemdup($pool
, id
+ position
, 7 - position
);
582 // XXX: at some point, this could become a keyword
585 for (CYIdentifier
*identifier(i
->identifier_
); identifier
!= NULL
; identifier
= identifier
->next_
)
586 identifier
->Set(name
);
590 void CYProperty::Replace(CYContext
&context
) { $
T()
591 context
.Replace(value_
);
592 next_
->Replace(context
);
595 CYStatement
*CYReturn::Replace(CYContext
&context
) {
596 if (context
.nonlocal_
!= NULL
) {
597 CYProperty
*value(value_
== NULL
? NULL
: $
CYProperty($
S("$cyv"), value_
));
598 return $
cy::Syntax::Throw($
CYObject(
599 $
CYProperty($
S("$cyk"), $
V(context
.nonlocal_
->Target(context
)), value
)
603 context
.Replace(value_
);
607 CYExpression
*CYRubyBlock::Replace(CYContext
&context
) {
608 // XXX: this needs to do something much more epic to handle return
609 return call_
->AddArgument(context
, proc_
->Replace(context
));
612 CYExpression
*CYRubyProc::Replace(CYContext
&context
) {
613 CYFunctionExpression
*function($
CYFunctionExpression(NULL
, parameters_
, code_
));
614 function
->nonlocal_
= context
.nextlocal_
;
618 CYScope::CYScope(CYScopeType type
, CYContext
&context
, CYStatement
*&statements
) :
621 statements_(statements
),
622 parent_(context
.scope_
)
624 context_
.scope_
= this;
627 void CYScope::Close() {
628 context_
.scope_
= parent_
;
629 Scope(context_
, statements_
);
632 void CYScope::Declare(CYContext
&context
, CYIdentifier
*identifier
, CYIdentifierFlags flags
) {
633 if (type_
== CYScopeCatch
&& flags
!= CYIdentifierCatch
)
634 parent_
->Declare(context
, identifier
, flags
);
636 internal_
.insert(CYIdentifierAddressFlagsMap::value_type(identifier
, flags
));
639 CYIdentifier
*CYScope::Lookup(CYContext
&context
, CYIdentifier
*identifier
) {
640 std::pair
<CYIdentifierValueSet::iterator
, bool> insert(identifiers_
.insert(identifier
));
641 return *insert
.first
;
644 void CYScope::Merge(CYContext
&context
, CYIdentifier
*identifier
) {
645 std::pair
<CYIdentifierValueSet::iterator
, bool> insert(identifiers_
.insert(identifier
));
646 if (!insert
.second
) {
647 if ((*insert
.first
)->offset_
< identifier
->offset_
)
648 (*insert
.first
)->offset_
= identifier
->offset_
;
649 identifier
->replace_
= *insert
.first
;
650 (*insert
.first
)->usage_
+= identifier
->usage_
+ 1;
655 struct IdentifierOffset
{
657 CYIdentifierFlags flags_
;
659 CYIdentifier
*identifier_
;
661 IdentifierOffset(CYIdentifier
*identifier
, CYIdentifierFlags flags
) :
662 offset_(identifier
->offset_
),
664 usage_(identifier
->usage_
),
665 identifier_(identifier
)
670 struct IdentifierOffsetLess
:
671 std::binary_function
<const IdentifierOffset
&, const IdentifierOffset
&, bool>
673 _finline
bool operator ()(const IdentifierOffset
&lhs
, const IdentifierOffset
&rhs
) const {
674 if (lhs
.offset_
!= rhs
.offset_
)
675 return lhs
.offset_
< rhs
.offset_
;
676 if (lhs
.flags_
!= rhs
.flags_
)
677 return lhs
.flags_
< rhs
.flags_
;
678 /*if (lhs.usage_ != rhs.usage_)
679 return lhs.usage_ < rhs.usage_;*/
680 return lhs
.identifier_
< rhs
.identifier_
;
684 typedef std::set
<IdentifierOffset
, IdentifierOffsetLess
> IdentifierOffsets
;
687 void CYScope::Scope(CYContext
&context
, CYStatement
*&statements
) {
691 CYDeclarations
*last(NULL
), *curr(NULL
);
693 IdentifierOffsets offsets
;
695 for (CYIdentifierAddressFlagsMap::const_iterator
i(internal_
.begin()); i
!= internal_
.end(); ++i
)
696 if (i
->second
!= CYIdentifierMagic
)
697 offsets
.insert(IdentifierOffset(i
->first
, i
->second
));
701 for (IdentifierOffsets::const_iterator
i(offsets
.begin()); i
!= offsets
.end(); ++i
) {
702 if (i
->flags_
== CYIdentifierVariable
) {
703 CYDeclarations
*next($
CYDeclarations($
CYDeclaration(i
->identifier_
)));
711 if (offset
< i
->offset_
)
713 if (context
.rename_
.size() <= offset
)
714 context
.rename_
.resize(offset
+ 1);
716 CYIdentifierUsage
&rename(context
.rename_
[offset
++]);
717 i
->identifier_
->SetNext(rename
.identifier_
);
718 rename
.identifier_
= i
->identifier_
;
719 rename
.usage_
+= i
->identifier_
->usage_
+ 1;
723 CYVar
*var($
CYVar(last
));
724 var
->SetNext(statements
);
728 for (CYIdentifierValueSet::const_iterator
i(identifiers_
.begin()); i
!= identifiers_
.end(); ++i
)
729 if (internal_
.find(*i
) == internal_
.end()) {
730 //std::cout << *i << '=' << offset << std::endl;
731 if ((*i
)->offset_
< offset
)
732 (*i
)->offset_
= offset
;
733 parent_
->Merge(context
, *i
);
737 CYStatement
*CYStatement::Collapse(CYContext
&context
) {
741 CYString
*CYString::Concat(CYContext
&context
, CYString
*rhs
) const {
742 size_t size(size_
+ rhs
->size_
);
743 char *value($
char[size
+ 1]);
744 memcpy(value
, value_
, size_
);
745 memcpy(value
+ size_
, rhs
->value_
, rhs
->size_
);
747 return $
S(value
, size
);
750 CYNumber
*CYString::Number(CYContext
&context
) {
751 // XXX: there is a precise algorithm for this
755 CYString
*CYString::String(CYContext
&context
) {
759 CYStatement
*CYSwitch::Replace(CYContext
&context
) {
760 context
.Replace(value_
);
761 clauses_
->Replace(context
);
765 CYExpression
*CYThis::Replace(CYContext
&context
) {
772 CYStatement
*Throw::Replace(CYContext
&context
) {
773 context
.Replace(value_
);
779 CYExpression
*CYTrivial::Replace(CYContext
&context
) {
783 CYNumber
*CYTrue::Number(CYContext
&context
) {
787 CYString
*CYTrue::String(CYContext
&context
) {
794 CYStatement
*Try::Replace(CYContext
&context
) {
795 code_
.Replace(context
);
796 catch_
->Replace(context
);
797 finally_
->Replace(context
);
803 CYStatement
*CYVar::Replace(CYContext
&context
) {
804 return $
E(declarations_
->Replace(context
));
807 CYExpression
*CYVariable::Replace(CYContext
&context
) {
808 context
.Replace(name_
);
812 CYStatement
*CYWhile::Replace(CYContext
&context
) {
813 context
.Replace(test_
);
814 context
.Replace(code_
);
818 CYStatement
*CYWith::Replace(CYContext
&context
) {
819 context
.Replace(scope_
);
820 context
.Replace(code_
);
824 CYExpression
*CYWord::ClassName(CYContext
&context
, bool object
) {
825 CYString
*name($
S(this));
827 return $
C1($
V("objc_getClass"), name
);