浏览代码

Add some runtime error checking

Matt Coles 9 年之前
父节点
当前提交
dec28251e2
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      stdlib.js

+ 4 - 0
stdlib.js

@@ -1,6 +1,10 @@
1 1
 const global_obj = {}
2 2
 module.exports = {
3 3
   assign: function (ref, value) {
4
+    if (!ref.name) {
5
+      console.error('Argument 1 of assign must always be a VariableReference')
6
+      process.exit(1)
7
+    }
4 8
     global_obj[ref.name] = value.value
5 9
   },
6 10
   add: function (arg1, arg2) {