equal
deleted
inserted
replaced
7 classVariableNames:'' |
7 classVariableNames:'' |
8 poolDictionaries:'' |
8 poolDictionaries:'' |
9 category:'PetitCompiler-Nodes' |
9 category:'PetitCompiler-Nodes' |
10 ! |
10 ! |
11 |
11 |
12 !PPCLiteralNode methodsFor:'compiling'! |
12 !PPCLiteralNode methodsFor:'visiting'! |
13 |
13 |
14 compileWith: compiler effect: effect id: id |
14 accept: visitor |
15 | encodedLiteral | |
15 ^ visitor visitLiteralNode: self |
16 |
|
17 encodedLiteral := self encodeQuotes: literal. |
|
18 compiler startMethod: id. |
|
19 compiler addVariable: 'retval'. |
|
20 compiler addVariable: 'position'. |
|
21 compiler add: 'position := context position.'. |
|
22 |
|
23 compiler add: 'retval := context next: ', literal size asString, '.'. |
|
24 compiler add: 'retval = #''', encodedLiteral, ''' ifTrue: [ ^ #''', encodedLiteral, '''].'. |
|
25 compiler add: 'context position: position.'. |
|
26 compiler add: '^ self error: ''', encodedLiteral, ' expected'' at: position'. |
|
27 ^ compiler stopMethod. |
|
28 ! ! |
16 ! ! |
29 |
17 |
30 !PPCLiteralNode methodsFor:'optimizing'! |
|
31 |
|
32 asInlined |
|
33 ^ PPCInlineLiteralNode new |
|
34 literal: literal; |
|
35 name: name; |
|
36 yourself |
|
37 ! ! |
|
38 |
|