Kaynağa Gözat

Add some runtime error checking

Matt Coles 9 yıl önce
ebeveyn
işleme
dec28251e2
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  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) {