cue: compile builtins at init time

Also allow any CUE as literal value for builtins.
This, in turn, is necessary to define some useful core
types (like time.Time) as well as to give better support
for the scripting layer, allowing better abstractions
for tools.

Updates #24

Change-Id: Icdcf7dfe7330bcc0efef437689503a84bcf3567c
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/1721
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/cue/ast.go b/cue/ast.go
index 5e02b9e..4c5ece5 100644
--- a/cue/ast.go
+++ b/cue/ast.go
@@ -127,14 +127,13 @@
 
 func (v *astVisitor) loadImport(imp *ast.ImportSpec) evaluated {
 	ctx := v.ctx()
-	val := lookupBuiltinPkg(ctx, imp)
-	if !isBottom(val) {
-		return val
-	}
 	path, err := literal.Unquote(imp.Path.Value)
 	if err != nil {
 		return ctx.mkErr(newNode(imp), "illformed import spec")
 	}
+	if p := getBuiltinPkg(ctx, path); p != nil {
+		return p
+	}
 	bimp := v.inst.LookupImport(path)
 	if bimp == nil {
 		return ctx.mkErr(newNode(imp), "package %q not found", path)