# Compile block code

**URL:** <https://forum.snap.berkeley.edu/t/compile-block-code/14842>\
**Category:** Advanced Topics\
**Tags:** custom-block, features, technical\
**Created:** [October 14, 2023, 12:42am UTC](https://forum.snap.berkeley.edu/t/compile-block-code/14842 "2023-10-14T00:42:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![awdeni](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/awdeni/32/28833_2.png) [@awdeni](https://forum.snap.berkeley.edu/u/awdeni)\
**Post date:** [October 14, 2023, 12:42am UTC](https://forum.snap.berkeley.edu/t/compile-block-code/14842/1 "2023-10-14T00:42:19Z")

</div>

Hey guys I’m here to report the code for the jit compiler compile block or reporter im 50% sure this is the code for it??? if (inp instanceof RingMorph) {  
inp = inp.children;  
return new JSCompiler(this.process,this.scope).compileFunctionBody({  
'expression': inp[0].children[0],  
'inputs': inp[1].inputs().map(x =\> x.children[0].blockSpec),  
'receiver': this.source.receiver  
}, '');  
}  
if (inp instanceof MultiArgMorph) {  
return 'new List([' + this.compileInputs(inp.inputs()) + '])';  
}  
if (inp instanceof ArgLabelMorph) {  
return this.compileInput(inp.argMorph());  
}  
if (inp instanceof ArgMorph) {  
// literal - evaluate inline  
value = inp.evaluate();  
type = this.process.reportTypeOf(value);  
switch (type) {  
case 'number':  
case 'Boolean':  
return '' + value;  
case 'text':  
// escape and enclose in double quotes  
return '"' + this.escape(value) + '"';  
case 'list':  
return 'new List([' + this.compileInputs(value) + '])';  
default:  
if (value instanceof Array) {  
return '["' + this.escape(value[0]) + '"]';  
}  
throw new Error(  
'compiling does not yet support\n' +  
'inputs of type\n' +  
type  
);  
}  
}  
if (inp instanceof BlockMorph) {  
return this.compileExpression(inp);  
}  
throw new Error(  
'compiling does not yet support\n' +  
'input slots of type\n' +  
inp.constructor.name  
);  
};

---

<div class="post-metadata">

**Author:** ![ego-lay\_atman-bay](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/ego-lay_atman-bay/32/1395_2.png) [@ego-lay\_atman-bay](https://forum.snap.berkeley.edu/u/ego-lay_atman-bay)\
**Post date:** [October 14, 2023, 3:27pm UTC](https://forum.snap.berkeley.edu/t/compile-block-code/14842/2 "2023-10-14T15:27:42Z")

</div>

You know you can add code blocks, right? Just click on the \</\> button or type

````auto
```javascript
Code
```

````

Also, there isn't a reason for this post to exist, because anyone can look at the source code.

---

<div class="post-metadata">

**Author:** ![awdeni](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/awdeni/32/28833_2.png) [@awdeni](https://forum.snap.berkeley.edu/u/awdeni)\
**Post date:** [October 14, 2023, 3:36pm UTC](https://forum.snap.berkeley.edu/t/compile-block-code/14842/3 "2023-10-14T15:36:14Z")

</div>

Oh yeah but there is this new weird block or has been there once you enable jit compiler shift click on settings and it is weird
