Comparing version 0.0.3 to 0.0.4
41
index.js
@@ -17,2 +17,6 @@ // petard, an llvm library | ||
f16: petard.getFloatTy(16), | ||
f32: petard.getFloatTy(32), | ||
f64: petard.getFloatTy(64), | ||
pointerTo: petard.getPointerTy | ||
@@ -81,3 +85,40 @@ | ||
// structured switch statement helper | ||
var switchimpl = function Switch(cond) { | ||
var that = this; | ||
var merge = this.splitBlock("after"); | ||
var defaultBlock = this.createBlock("default"); | ||
defaultBlock.insertAfter(); | ||
defaultBlock.br(merge); | ||
defaultBlock.insertBefore(); | ||
var sw = this.switch(cond, defaultBlock); | ||
this.useBlock(merge); | ||
return { | ||
defaultCase: defaultBlock, | ||
addCase: function addCase(onVal) { | ||
var caseBlock = that.createBlock("case" + onVal); | ||
caseBlock.insertAfter(); | ||
caseBlock.br(merge); | ||
caseBlock.insertBefore(); | ||
sw.addCase(onVal, caseBlock); | ||
return caseBlock; | ||
} | ||
}; | ||
}; | ||
attach("select", switchimpl); | ||
// export everything | ||
module.exports = petard; |
{ | ||
"name": "petard", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "a js llvm library", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"clean": "node-gyp clean", | ||
"build": "LLVM_CONFIG=llvm-config node-gyp configure && node-gyp build", | ||
"build": "node-gyp configure && node-gyp build", | ||
"test": "node_modules/mocha/bin/mocha --reporter spec" | ||
@@ -11,0 +11,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
107767
35
81
546