Commit Graph

27 Commits

Author SHA1 Message Date
Mike Gray
47794ca754 Removing [U]Int[8|16|32|64] and Float[32|64] in favor of Number 2016-04-27 16:24:13 -04:00
Erik Arvidsson
02c47661fd Make all usages of Type in Go use pointers (#1295)
This is in preparation of allowing back references which requires
pointers to be able to compare that the structs are the same.
2016-04-22 15:19:42 -07:00
Erik Arvidsson
5896559db7 Remove support for enums (#1291) 2016-04-22 10:14:05 -07:00
Erik Arvidsson
c91b8146dc Go: Eagerly fixup types after the Package has been created (#1241)
This fixes the package refs in NewPackage and makes the serializer
know about these refs when a Package is encoded.
2016-04-13 18:09:22 -07:00
Erik Arvidsson
9e4266871e JS CodeGen: Add newSetOfT etc (#1195)
* JS CodeGen: Add newSetOfT etc

This generates convenience functions for new list/set/map.

Issue #1081
2016-04-08 15:01:08 -07:00
Erik Arvidsson
ea51e1ccfc Handle imports in js codegen
Issue #1081
2016-04-06 11:46:13 -07:00
Erik Arvidsson
1014573c7e Codegen for enum types
This generates a flow type for enums:

```noms
enum Handedness {
  right
  left
  switch
}
```

Generates

```js
type E =
  0 |  // right
  1 |  // left
  2;  // switch
```

Issue #1081
2016-04-05 15:12:04 -07:00
Erik Arvidsson
d1a6fbe0c7 Codegen for flow struct types.
This generates the a flow interface for structs defined in noms files

Issue #1157
Issue #1081
2016-04-05 14:19:08 -07:00
Erik Arvidsson
870f5b1420 NomDL JS CodeGen
This is the first step towards generating JS code from NomDL.

At this point, only the code to create and register the
Package is done.
2016-03-30 13:19:33 -07:00
Rafael Weinstein
6c3239a1d0 Collections no longer need a ChunkStore on creation 2016-02-02 13:39:26 -08:00
Erik Arvidsson
61f14f8c9a Rename noms UInt* to Uint*
Fixes #673
2015-12-02 12:01:42 -05:00
Rafael Weinstein
7caa08bc5c Complex Types embed a ChunkStore 2015-12-01 10:40:47 -08:00
Erik Arvidsson
a72ce41a1d Go: TypeRef -> Type
Remaining identifiers
2015-11-13 17:54:53 -05:00
Chris Masone
eda9b92870 Rename types.TypeRef to types.Type
There are probably still a lot of variable names and comments to fix,
but this updates all the Go code.

Towards #441
2015-11-09 08:26:32 -08:00
Erik Arvidsson
9aadd85004 Add types.Struct and improve typed structs
The generated code for typed structs now uses a Go struct which
implements Value directly. The fields in this struct uses the "user"
type. (The union value still uses types.Value though.)

When a typed struct is created by the decoder, it asks for a struct
builder which returns a channel that the values of the fields of the
struct are sent to.
2015-11-04 11:55:07 -05:00
Dan Willhite
13b2cf5702 Three mods to codegen.
1) truncate filenames containing hash to only use first 7 chars of hash.
2) change output filename from <base>.go to <base>_noms.go
3) check for includes of file in same directory and don't generate twice.
2015-10-28 14:28:15 -07:00
Erik Arvidsson
81f80d5ce6 NomDL: Encode compound blobs as structs
Before encoding a compoundBlob we create a compoundBlobStruct and
encode that instead.

After decoding we check if the value is a compoundBlobStruct and if so
we convert it to a compoundBlob.

Fixes #455, #165
2015-10-27 17:53:16 -04:00
Erik Arvidsson
cdcf952270 Update TypeRef comment and get rid of useless param
The name param of MakeCompoundTypeRef is always the empty string.

I didn't change the underlying storage or serialization.

Fixes #436, #477
2015-10-26 15:35:45 -04:00
Chris Masone
2cd6831598 Changes codegen.go to emit all code in a single Go package
Fixes #467
2015-10-23 16:42:54 -07:00
Erik Arvidsson
91e7ffb8e1 NomDL Codegen: Parameterize the types package
This allows us to use the codegen from types/ without manual touchups
2015-10-23 11:04:30 -04:00
Chris Masone
e810716e45 remove unreachable case 2015-10-22 10:56:13 -07:00
Chris Masone
1486d84487 Make generated Enum types implement types.Value
Fixes #391
2015-10-22 09:56:26 -07:00
Erik Arvidsson
3b20144ed8 NomDL: Clean up namespace handling in New calls
Fixes #449
2015-10-22 12:38:56 -04:00
Erik Arvidsson
16353f38f8 NomDL: Make the new serialization default
This makes the new typed serialization the default (the old
serialization is not used but the code has not been cleaned up yet).

Some things are no working in the new world:

Chunking -  The compound list is not working correctly any more. The
Chunks method is having issues because it assumed things based on the
old implicit chunking.

Commit - uses a `Set(Commit)` which means that the parent commit is
embedded. We need to change that to be `Set(Ref(Commit))` so that the
parent commit is referenced instead.
2015-10-21 19:04:22 -04:00
Erik Arvidsson
d6869cef35 NomDL: Make Package a primitive type
This solves the bootstrapping problems we are encountering.

Previously Package was a Struct but structs depend on Package.
2015-10-20 10:26:00 -04:00
Erik Arvidsson
36d9362628 NomDL: Use ordinal for unresolved type refs
Instead of using the name of the type we now use the index of the type
in the Package that defines it.
2015-10-16 17:46:15 -04:00
Chris Masone
56cd548328 Support compounding types with imported types.
Sets, Lists, Refs and Maps of imported types work now.

This PR also factors some of codegen.go into a separate package, to slim down
that file a bit.

Towards issue #294
2015-10-12 15:29:45 -07:00