diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-02 15:16:36 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-02 15:16:36 -0800 |
commit | c8d952474f8cec1ba06e1f4a8389900de06dc512 (patch) | |
tree | bc00693b531dce6fbcaaaabd2e6667aff2d273d1 /src/parseTools.js | |
parent | 947c6fe1b397b33b1db934a527d482e14ea97a2e (diff) |
parsing optimization in isStructType
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index e73bd097..e81f5d27 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -116,16 +116,16 @@ function isStructPointerType(type) { return !Runtime.isNumberType(type) && type[0] == '%'; } +function isPointerType(type) { + return type[type.length-1] == '*'; +} + function isStructType(type) { if (isPointerType(type)) return false; - if (new RegExp(/^\[\d+\ x\ (.*)\]/g).test(type)) return true; // [15 x ?] blocks. Like structs - if (new RegExp(/<?{ [^}]* }>?/g).test(type)) return true; // { i32, i8 } etc. - anonymous struct types + if (/^\[\d+\ x\ (.*)\]/.test(type)) return true; // [15 x ?] blocks. Like structs + if (/<?{ [^}]* }>?/.test(type)) return true; // { i32, i8 } etc. - anonymous struct types // See comment in isStructPointerType() - return !Runtime.isNumberType(type) && type[0] == '%'; -} - -function isPointerType(type) { - return pointingLevels(type) > 0; + return type[0] == '%'; } function isIntImplemented(type) { |