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 CYExpression
*variable(Replace(context
));
200 return initialiser_
== NULL
? NULL
: $
CYAssign(variable
, initialiser_
);
203 CYStatement
*CYDeclaration::ForEachIn(CYContext
&context
, CYExpression
*value
) {
204 return $
CYVar($
L1($
L(identifier_
, value
)));
207 CYExpression
*CYDeclaration::Replace(CYContext
&context
) {
208 context
.Replace(identifier_
);
209 context
.scope_
->Declare(context
, identifier_
, CYIdentifierVariable
);
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::Collapse(CYContext
&context
) {
244 CYStatement
*CYEmpty::Replace(CYContext
&context
) {
248 CYStatement
*CYExpress::Collapse(CYContext
&context
) {
249 if (CYExpress
*express
= dynamic_cast<CYExpress
*>(next_
)) {
250 CYCompound
*next(dynamic_cast<CYCompound
*>(express
->expression_
));
252 next
= $
CYCompound(express
->expression_
);
253 next
->AddPrev(expression_
);
255 SetNext(express
->next_
);
261 CYStatement
*CYExpress::Replace(CYContext
&context
) {
262 context
.Replace(expression_
);
263 if (expression_
== NULL
)
268 CYExpression
*CYExpression::AddArgument(CYContext
&context
, CYExpression
*value
) {
269 return $
C1(this, value
);
272 CYExpression
*CYExpression::ClassName(CYContext
&context
, bool object
) {
276 CYStatement
*CYExpression::ForEachIn(CYContext
&context
, CYExpression
*value
) {
277 return $
E($
CYAssign(this, value
));
280 CYNumber
*CYFalse::Number(CYContext
&context
) {
284 CYString
*CYFalse::String(CYContext
&context
) {
288 void CYFinally::Replace(CYContext
&context
) { $
T()
289 code_
.Replace(context
);
292 CYStatement
*CYFor::Replace(CYContext
&context
) {
293 context
.Replace(initialiser_
);
294 context
.Replace(test_
);
295 context
.Replace(increment_
);
296 context
.Replace(code_
);
300 CYStatement
*CYForIn::Replace(CYContext
&context
) {
301 // XXX: this actually might need a prefix statement
302 context
.Replace(initialiser_
);
303 context
.Replace(set_
);
304 context
.Replace(code_
);
308 CYFunctionParameter
*CYForInComprehension::Parameter(CYContext
&context
) const {
309 return $
CYFunctionParameter(name_
);
312 CYStatement
*CYForInComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
313 return $
CYForIn($
V(name_
), set_
, CYComprehension::Replace(context
, statement
));
316 CYStatement
*CYForEachIn::Replace(CYContext
&context
) {
317 CYIdentifier
*cys($
I("$cys")), *cyt($
I("$cyt"));
319 return $
CYLet($
L2($
L(cys
, set_
), $
L(cyt
)), $$
->*
320 $
CYForIn($
V(cyt
), $
V(cys
), $
CYBlock($$
->*
321 initialiser_
->ForEachIn(context
, $
M($
V(cys
), $
V(cyt
)))->*
327 CYFunctionParameter
*CYForEachInComprehension::Parameter(CYContext
&context
) const {
328 return $
CYFunctionParameter(name_
);
331 CYStatement
*CYForEachInComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
332 CYIdentifier
*cys($
I("cys"));
334 return $
E($
C0($
F(NULL
, $
P1("$cys"), $$
->*
335 $
E($
CYAssign($
V(cys
), set_
))->*
336 $
CYForIn($
V(name_
), $
V(cys
), $
CYBlock($$
->*
337 $
E($
CYAssign($
V(name_
), $
M($
V(cys
), $
V(name_
))))->*
338 CYComprehension::Replace(context
, statement
)
343 void CYFunction::Inject(CYContext
&context
) {
344 context
.Replace(name_
);
345 context
.scope_
->Declare(context
, name_
, CYIdentifierOther
);
348 void CYFunction::Replace_(CYContext
&context
, bool outer
) {
352 CYScope
scope(CYScopeFunction
, context
, code_
.statements_
);
354 CYNonLocal
*nonlocal(context
.nonlocal_
);
355 CYNonLocal
*nextlocal(context
.nextlocal_
);
358 if (nonlocal_
!= NULL
) {
360 context
.nonlocal_
= nonlocal_
;
363 nonlocal_
= $
CYNonLocal();
364 context
.nextlocal_
= nonlocal_
;
367 if (!outer
&& name_
!= NULL
)
370 if (parameters_
!= NULL
)
371 parameters_
= parameters_
->Replace(context
, code_
);
373 code_
.Replace(context
);
376 context
.NonLocal(code_
.statements_
);
378 context
.nextlocal_
= nextlocal
;
379 context
.nonlocal_
= nonlocal
;
384 CYExpression
*CYFunctionExpression::Replace(CYContext
&context
) {
385 Replace_(context
, false);
389 CYFunctionParameter
*CYFunctionParameter::Replace(CYContext
&context
, CYBlock
&code
) {
390 context
.Replace(name_
);
391 context
.scope_
->Declare(context
, name_
, CYIdentifierArgument
);
393 next_
= next_
->Replace(context
, code
);
397 CYStatement
*CYFunctionStatement::Replace(CYContext
&context
) {
398 Replace_(context
, true);
402 CYIdentifier
*CYIdentifier::Replace(CYContext
&context
) {
403 if (replace_
!= NULL
&& replace_
!= this)
404 return replace_
->Replace(context
);
405 replace_
= context
.scope_
->Lookup(context
, this);
409 CYStatement
*CYIf::Replace(CYContext
&context
) {
410 context
.Replace(test_
);
411 context
.Replace(true_
);
412 context
.Replace(false_
);
416 CYFunctionParameter
*CYIfComprehension::Parameter(CYContext
&context
) const {
420 CYStatement
*CYIfComprehension::Replace(CYContext
&context
, CYStatement
*statement
) const {
421 return $
CYIf(test_
, CYComprehension::Replace(context
, statement
));
424 CYExpression
*CYIndirect::Replace(CYContext
&context
) {
425 CYPrefix::Replace(context
);
426 return $
M(rhs_
, $
S("$cyi"));
429 CYExpression
*CYIndirectMember::Replace(CYContext
&context
) {
431 return $
M($
CYIndirect(object_
), property_
);
434 CYExpression
*CYInfix::Replace(CYContext
&context
) {
435 context
.Replace(lhs_
);
436 context
.Replace(rhs_
);
440 CYStatement
*CYLabel::Replace(CYContext
&context
) {
441 context
.Replace(statement_
);
445 CYStatement
*CYLet::Replace(CYContext
&context
) {
446 return $
CYWith($
CYObject(declarations_
->Property(context
)), &code_
);
449 void CYMember::Replace_(CYContext
&context
) {
450 context
.Replace(object_
);
451 context
.Replace(property_
);
457 CYExpression
*New::AddArgument(CYContext
&context
, CYExpression
*value
) {
458 CYSetLast(arguments_
, $
CYArgument(value
));
462 CYExpression
*New::Replace(CYContext
&context
) {
463 context
.Replace(constructor_
);
464 arguments_
->Replace(context
);
470 CYNumber
*CYNull::Number(CYContext
&context
) {
474 CYString
*CYNull::String(CYContext
&context
) {
478 CYNumber
*CYNumber::Number(CYContext
&context
) {
482 CYString
*CYNumber::String(CYContext
&context
) {
483 // XXX: there is a precise algorithm for this
484 return $
S(apr_psprintf($pool
, "%.17g", Value()));
487 CYExpression
*CYObject::Replace(CYContext
&context
) {
488 properties_
->Replace(context
);
492 CYFunctionParameter
*CYOptionalFunctionParameter::Replace(CYContext
&context
, CYBlock
&code
) {
493 CYFunctionParameter
*parameter($
CYFunctionParameter(name_
, next_
));
494 parameter
= parameter
->Replace(context
, code
);
495 context
.Replace(initializer_
);
497 CYVariable
*name($
V(name_
));
498 code
.AddPrev($
CYIf($
CYIdentical($
CYTypeOf(name
), $
S("undefined")), $$
->*
499 $
E($
CYAssign(name
, initializer_
))
505 CYExpression
*CYPostfix::Replace(CYContext
&context
) {
506 context
.Replace(lhs_
);
510 CYExpression
*CYPrefix::Replace(CYContext
&context
) {
511 context
.Replace(rhs_
);
515 // XXX: this is evil evil black magic. don't ask, don't tell... don't believe!
516 #define MappingSet "0etnirsoalfucdphmgyvbxTwSNECAFjDLkMOIBPqzRH$_WXUVGYKQJZ"
517 //#define MappingSet "0abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"
520 struct IdentifierUsageLess
:
521 std::binary_function
<CYIdentifier
*, CYIdentifier
*, bool>
523 _finline
bool operator ()(CYIdentifier
*lhs
, CYIdentifier
*rhs
) const {
524 if (lhs
->usage_
!= rhs
->usage_
)
525 return lhs
->usage_
> rhs
->usage_
;
530 typedef std::set
<CYIdentifier
*, IdentifierUsageLess
> IdentifierUsages
;
533 void CYProgram::Replace(CYContext
&context
) {
534 CYScope
scope(CYScopeProgram
, context
, statements_
);
536 context
.nextlocal_
= $
CYNonLocal();
537 context
.ReplaceAll(statements_
);
538 context
.NonLocal(statements_
);
544 CYCStringSet external
;
545 for (CYIdentifierValueSet::const_iterator
i(scope
.identifiers_
.begin()); i
!= scope
.identifiers_
.end(); ++i
)
546 external
.insert((*i
)->Word());
548 IdentifierUsages usages
;
550 if (offset
< context
.rename_
.size())
551 CYForEach (i
, context
.rename_
[offset
].identifier_
)
554 // XXX: totalling the probable occurrences and sorting by them would improve the result
555 for (CYIdentifierUsageVector::const_iterator
i(context
.rename_
.begin()); i
!= context
.rename_
.end(); ++i
, ++offset
) {
556 //std::cout << *i << ":" << (*i)->offset_ << std::endl;
560 if (context
.options_
.verbose_
)
561 name
= apr_psprintf($pool
, "$%"APR_SIZE_T_FMT
"", offset
);
567 unsigned position(7), local(offset
+ 1);
570 unsigned index(local
% (sizeof(MappingSet
) - 1));
571 local
/= sizeof(MappingSet
) - 1;
572 id
[--position
] = MappingSet
[index
];
573 } while (local
!= 0);
575 if (external
.find(id
+ position
) != external
.end()) {
580 name
= apr_pstrmemdup($pool
, id
+ position
, 7 - position
);
581 // XXX: at some point, this could become a keyword
584 CYForEach (identifier
, i
->identifier_
)
585 identifier
->Set(name
);
589 void CYProperty::Replace(CYContext
&context
) { $
T()
590 context
.Replace(value_
);
591 next_
->Replace(context
);
594 CYStatement
*CYReturn::Replace(CYContext
&context
) {
595 if (context
.nonlocal_
!= NULL
) {
596 CYProperty
*value(value_
== NULL
? NULL
: $
CYProperty($
S("$cyv"), value_
));
597 return $
cy::Syntax::Throw($
CYObject(
598 $
CYProperty($
S("$cyk"), $
V(context
.nonlocal_
->Target(context
)), value
)
602 context
.Replace(value_
);
606 CYExpression
*CYRubyBlock::Replace(CYContext
&context
) {
607 // XXX: this needs to do something much more epic to handle return
608 return call_
->AddArgument(context
, proc_
->Replace(context
));
611 CYExpression
*CYRubyProc::Replace(CYContext
&context
) {
612 CYFunctionExpression
*function($
CYFunctionExpression(NULL
, parameters_
, code_
));
613 function
->nonlocal_
= context
.nextlocal_
;
617 CYScope::CYScope(CYScopeType type
, CYContext
&context
, CYStatement
*&statements
) :
620 statements_(statements
),
621 parent_(context
.scope_
)
623 context_
.scope_
= this;
626 CYScope::~CYScope() {
629 void CYScope::Close() {
630 context_
.scope_
= parent_
;
631 Scope(context_
, statements_
);
634 void CYScope::Declare(CYContext
&context
, CYIdentifier
*identifier
, CYIdentifierFlags flags
) {
635 if (type_
== CYScopeCatch
&& flags
!= CYIdentifierCatch
)
636 parent_
->Declare(context
, identifier
, flags
);
638 internal_
.insert(CYIdentifierAddressFlagsMap::value_type(identifier
, flags
));
641 CYIdentifier
*CYScope::Lookup(CYContext
&context
, CYIdentifier
*identifier
) {
642 std::pair
<CYIdentifierValueSet::iterator
, bool> insert(identifiers_
.insert(identifier
));
643 return *insert
.first
;
646 void CYScope::Merge(CYContext
&context
, CYIdentifier
*identifier
) {
647 std::pair
<CYIdentifierValueSet::iterator
, bool> insert(identifiers_
.insert(identifier
));
648 if (!insert
.second
) {
649 if ((*insert
.first
)->offset_
< identifier
->offset_
)
650 (*insert
.first
)->offset_
= identifier
->offset_
;
651 identifier
->replace_
= *insert
.first
;
652 (*insert
.first
)->usage_
+= identifier
->usage_
+ 1;
657 struct IdentifierOffset
{
659 CYIdentifierFlags flags_
;
661 CYIdentifier
*identifier_
;
663 IdentifierOffset(CYIdentifier
*identifier
, CYIdentifierFlags flags
) :
664 offset_(identifier
->offset_
),
666 usage_(identifier
->usage_
),
667 identifier_(identifier
)
672 struct IdentifierOffsetLess
:
673 std::binary_function
<const IdentifierOffset
&, const IdentifierOffset
&, bool>
675 _finline
bool operator ()(const IdentifierOffset
&lhs
, const IdentifierOffset
&rhs
) const {
676 if (lhs
.offset_
!= rhs
.offset_
)
677 return lhs
.offset_
< rhs
.offset_
;
678 if (lhs
.flags_
!= rhs
.flags_
)
679 return lhs
.flags_
< rhs
.flags_
;
680 /*if (lhs.usage_ != rhs.usage_)
681 return lhs.usage_ < rhs.usage_;*/
682 return lhs
.identifier_
< rhs
.identifier_
;
686 typedef std::set
<IdentifierOffset
, IdentifierOffsetLess
> IdentifierOffsets
;
689 void CYScope::Scope(CYContext
&context
, CYStatement
*&statements
) {
693 CYDeclarations
*last(NULL
), *curr(NULL
);
695 IdentifierOffsets offsets
;
697 for (CYIdentifierAddressFlagsMap::const_iterator
i(internal_
.begin()); i
!= internal_
.end(); ++i
)
698 if (i
->second
!= CYIdentifierMagic
)
699 offsets
.insert(IdentifierOffset(i
->first
, i
->second
));
703 for (IdentifierOffsets::const_iterator
i(offsets
.begin()); i
!= offsets
.end(); ++i
) {
704 if (i
->flags_
== CYIdentifierVariable
) {
705 CYDeclarations
*next($
CYDeclarations($
CYDeclaration(i
->identifier_
)));
713 if (offset
< i
->offset_
)
715 if (context
.rename_
.size() <= offset
)
716 context
.rename_
.resize(offset
+ 1);
718 CYIdentifierUsage
&rename(context
.rename_
[offset
++]);
719 i
->identifier_
->SetNext(rename
.identifier_
);
720 rename
.identifier_
= i
->identifier_
;
721 rename
.usage_
+= i
->identifier_
->usage_
+ 1;
725 CYVar
*var($
CYVar(last
));
726 var
->SetNext(statements
);
730 for (CYIdentifierValueSet::const_iterator
i(identifiers_
.begin()); i
!= identifiers_
.end(); ++i
)
731 if (internal_
.find(*i
) == internal_
.end()) {
732 //std::cout << *i << '=' << offset << std::endl;
733 if ((*i
)->offset_
< offset
)
734 (*i
)->offset_
= offset
;
735 parent_
->Merge(context
, *i
);
739 CYStatement
*CYStatement::Collapse(CYContext
&context
) {
743 CYString
*CYString::Concat(CYContext
&context
, CYString
*rhs
) const {
744 size_t size(size_
+ rhs
->size_
);
745 char *value($
char[size
+ 1]);
746 memcpy(value
, value_
, size_
);
747 memcpy(value
+ size_
, rhs
->value_
, rhs
->size_
);
749 return $
S(value
, size
);
752 CYNumber
*CYString::Number(CYContext
&context
) {
753 // XXX: there is a precise algorithm for this
757 CYString
*CYString::String(CYContext
&context
) {
761 CYStatement
*CYSwitch::Replace(CYContext
&context
) {
762 context
.Replace(value_
);
763 clauses_
->Replace(context
);
767 CYExpression
*CYThis::Replace(CYContext
&context
) {
774 CYStatement
*Throw::Replace(CYContext
&context
) {
775 context
.Replace(value_
);
781 CYExpression
*CYTrivial::Replace(CYContext
&context
) {
785 CYNumber
*CYTrue::Number(CYContext
&context
) {
789 CYString
*CYTrue::String(CYContext
&context
) {
796 CYStatement
*Try::Replace(CYContext
&context
) {
797 code_
.Replace(context
);
798 catch_
->Replace(context
);
799 finally_
->Replace(context
);
805 CYStatement
*CYVar::Replace(CYContext
&context
) {
806 return $
E(declarations_
->Replace(context
));
809 CYExpression
*CYVariable::Replace(CYContext
&context
) {
810 context
.Replace(name_
);
814 CYStatement
*CYWhile::Replace(CYContext
&context
) {
815 context
.Replace(test_
);
816 context
.Replace(code_
);
820 CYStatement
*CYWith::Replace(CYContext
&context
) {
821 context
.Replace(scope_
);
822 context
.Replace(code_
);
826 CYExpression
*CYWord::ClassName(CYContext
&context
, bool object
) {
827 CYString
*name($
S(this));
829 return $
C1($
V("objc_getClass"), name
);