Skip to content

Commit

Permalink
tweak CompileResult type
Browse files Browse the repository at this point in the history
  • Loading branch information
Péter Diviánszky committed Feb 26, 2016
1 parent 5ea5e05 commit 2eb7cc7
Show file tree
Hide file tree
Showing 31 changed files with 50 additions and 46 deletions.
2 changes: 1 addition & 1 deletion ddl/Definitions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ typeInfo = do
]

data_ "CompileResult" $ do
const_ "CompileError" [Array "TypeInfo", Array "TypeInfo"]
const_ "CompileError" [Array "Range", String, Array "TypeInfo"]
const_ "Compiled" [String, "Pipeline", Array "TypeInfo"]

pipelineSchema = do
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.IR.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.442441000000Z
// 2016-02-26T11:37:22.233668000000Z

#include "LambdaCube.IR.hpp"
template<> json toJSON<std::shared_ptr<ArrayValue>>(std::shared_ptr<ArrayValue> &v) {
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.IR.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.442441000000Z
// 2016-02-26T11:37:22.233668000000Z

#ifndef HEADER_LambdaCube.IR_H
#define HEADER_LambdaCube.IR_H
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.IR.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.442441000000Z
-- 2016-02-26T11:37:22.233668000000Z

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module LambdaCube.IR where
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.IR.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.442441000000Z
-- 2016-02-26T11:37:22.233668000000Z

module LambdaCube.IR where
import Prelude
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.IR.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.442441000000Z
// 2016-02-26T11:37:22.233668000000Z

typealias StreamName = Int

Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.IR2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.442441000000Z
// 2016-02-26T11:37:22.233668000000Z

#ifndef HEADER_LambdaCube.IR_H
#define HEADER_LambdaCube.IR_H
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.Mesh.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.794796000000Z
// 2016-02-26T11:37:22.580893000000Z

#include "LambdaCube.Mesh.hpp"
template<> json toJSON<std::shared_ptr<MeshAttribute>>(std::shared_ptr<MeshAttribute> &v) {
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.Mesh.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.794796000000Z
// 2016-02-26T11:37:22.580893000000Z

#ifndef HEADER_LambdaCube.Mesh_H
#define HEADER_LambdaCube.Mesh_H
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.Mesh.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.794796000000Z
-- 2016-02-26T11:37:22.580893000000Z

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module LambdaCube.Mesh where
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.Mesh.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.794796000000Z
-- 2016-02-26T11:37:22.580893000000Z

module LambdaCube.Mesh where
import Prelude
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.Mesh.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.794796000000Z
// 2016-02-26T11:37:22.580893000000Z

enum MeshAttribute {
case A_Float(Array<Float>)
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.Mesh2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.794796000000Z
// 2016-02-26T11:37:22.580893000000Z

#ifndef HEADER_LambdaCube.Mesh_H
#define HEADER_LambdaCube.Mesh_H
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.PipelineSchema.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.775644000000Z
// 2016-02-26T11:37:22.561871000000Z

#include "LambdaCube.PipelineSchema.hpp"
template<> json toJSON<std::shared_ptr<StreamType>>(std::shared_ptr<StreamType> &v) {
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.PipelineSchema.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.775644000000Z
// 2016-02-26T11:37:22.561871000000Z

#ifndef HEADER_LambdaCube.PipelineSchema_H
#define HEADER_LambdaCube.PipelineSchema_H
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.PipelineSchema.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.775644000000Z
-- 2016-02-26T11:37:22.561871000000Z

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module LambdaCube.PipelineSchema where
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.PipelineSchema.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.775644000000Z
-- 2016-02-26T11:37:22.561871000000Z

module LambdaCube.PipelineSchema where
import Prelude
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.PipelineSchema.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.775644000000Z
// 2016-02-26T11:37:22.561871000000Z

enum StreamType {
case Attribute_Word
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/LambdaCube.PipelineSchema2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.775644000000Z
// 2016-02-26T11:37:22.561871000000Z

#ifndef HEADER_LambdaCube.PipelineSchema_H
#define HEADER_LambdaCube.PipelineSchema_H
Expand Down
8 changes: 5 additions & 3 deletions ddl/out/LambdaCube.TypeInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.823283000000Z
// 2016-02-26T11:37:22.609565000000Z

#include "LambdaCube.TypeInfo.hpp"
template<> json toJSON<std::shared_ptr<Range>>(std::shared_ptr<Range> &v) {
Expand Down Expand Up @@ -77,6 +77,7 @@ template<> json toJSON<std::shared_ptr<CompileResult>>(std::shared_ptr<CompileRe
std::shared_ptr<data::CompileError> tv = std::static_pointer_cast<data::CompileError>(v);
obj["arg0"] = toJSON(tv->_0);
obj["arg1"] = toJSON(tv->_1);
obj["arg2"] = toJSON(tv->_2);
}
break;
case ::CompileResult::tag::Compiled:
Expand All @@ -98,8 +99,9 @@ template<> std::shared_ptr<CompileResult> fromJSON<std::shared_ptr<CompileResult
if (tag == "CompileError") {
tagType = ::CompileResult::tag::CompileError;
std::shared_ptr<data::CompileError> tv(new data::CompileError());
tv->_0 = fromJSON(W<std::vector<std::shared_ptr<::TypeInfo>>>(), obj["arg0"]);
tv->_1 = fromJSON(W<std::vector<std::shared_ptr<::TypeInfo>>>(), obj["arg1"]);
tv->_0 = fromJSON(W<std::vector<std::shared_ptr<::Range>>>(), obj["arg0"]);
tv->_1 = fromJSON(W<String>(), obj["arg1"]);
tv->_2 = fromJSON(W<std::vector<std::shared_ptr<::TypeInfo>>>(), obj["arg2"]);
return tv;
}
else if (tag == "Compiled") {
Expand Down
7 changes: 4 additions & 3 deletions ddl/out/LambdaCube.TypeInfo.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.823283000000Z
// 2016-02-26T11:37:22.609565000000Z

#ifndef HEADER_LambdaCube.TypeInfo_H
#define HEADER_LambdaCube.TypeInfo_H
Expand Down Expand Up @@ -48,8 +48,9 @@ class CompileResult {
namespace data {
class CompileError : public ::CompileResult {
public:
std::vector<std::shared_ptr<::TypeInfo>> _0;
std::vector<std::shared_ptr<::TypeInfo>> _1;
std::vector<std::shared_ptr<::Range>> _0;
String _1;
std::vector<std::shared_ptr<::TypeInfo>> _2;
CompileError() { tag = tag::CompileError; }
};
class Compiled : public ::CompileResult {
Expand Down
8 changes: 4 additions & 4 deletions ddl/out/LambdaCube.TypeInfo.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.823283000000Z
-- 2016-02-26T11:37:22.609565000000Z

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module LambdaCube.TypeInfo where
Expand Down Expand Up @@ -36,7 +36,7 @@ data TypeInfo
deriving (Show, Eq, Ord)

data CompileResult
= CompileError (Vector TypeInfo) (Vector TypeInfo)
= CompileError (Vector Range) String (Vector TypeInfo)
| Compiled String Pipeline (Vector TypeInfo)
deriving (Show, Eq, Ord)

Expand Down Expand Up @@ -91,14 +91,14 @@ instance FromJSON TypeInfo where

instance ToJSON CompileResult where
toJSON v = case v of
CompileError arg0 arg1 -> object [ "tag" .= ("CompileError" :: Text), "arg0" .= arg0, "arg1" .= arg1]
CompileError arg0 arg1 arg2 -> object [ "tag" .= ("CompileError" :: Text), "arg0" .= arg0, "arg1" .= arg1, "arg2" .= arg2]
Compiled arg0 arg1 arg2 -> object [ "tag" .= ("Compiled" :: Text), "arg0" .= arg0, "arg1" .= arg1, "arg2" .= arg2]

instance FromJSON CompileResult where
parseJSON (Object obj) = do
tag <- obj .: "tag"
case tag :: Text of
"CompileError" -> CompileError <$> obj .: "arg0" <*> obj .: "arg1"
"CompileError" -> CompileError <$> obj .: "arg0" <*> obj .: "arg1" <*> obj .: "arg2"
"Compiled" -> Compiled <$> obj .: "arg0" <*> obj .: "arg1" <*> obj .: "arg2"
parseJSON _ = mzero

8 changes: 4 additions & 4 deletions ddl/out/LambdaCube.TypeInfo.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.823283000000Z
-- 2016-02-26T11:37:22.609565000000Z

module LambdaCube.TypeInfo where
import Prelude
Expand Down Expand Up @@ -35,7 +35,7 @@ data TypeInfo


data CompileResult
= CompileError (Array TypeInfo) (Array TypeInfo)
= CompileError (Array Range) String (Array TypeInfo)
| Compiled String Pipeline (Array TypeInfo)


Expand Down Expand Up @@ -90,14 +90,14 @@ instance decodeJsonTypeInfo :: DecodeJson TypeInfo where

instance encodeJsonCompileResult :: EncodeJson CompileResult where
encodeJson v = case v of
CompileError arg0 arg1 -> "tag" := "CompileError" ~> "arg0" := arg0 ~> "arg1" := arg1 ~> jsonEmptyObject
CompileError arg0 arg1 arg2 -> "tag" := "CompileError" ~> "arg0" := arg0 ~> "arg1" := arg1 ~> "arg2" := arg2 ~> jsonEmptyObject
Compiled arg0 arg1 arg2 -> "tag" := "Compiled" ~> "arg0" := arg0 ~> "arg1" := arg1 ~> "arg2" := arg2 ~> jsonEmptyObject

instance decodeJsonCompileResult :: DecodeJson CompileResult where
decodeJson json = do
obj <- decodeJson json
tag <- obj .? "tag"
case tag of
"CompileError" -> CompileError <$> obj .? "arg0" <*> obj .? "arg1"
"CompileError" -> CompileError <$> obj .? "arg0" <*> obj .? "arg1" <*> obj .? "arg2"
"Compiled" -> Compiled <$> obj .? "arg0" <*> obj .? "arg1" <*> obj .? "arg2"

8 changes: 4 additions & 4 deletions ddl/out/LambdaCube.TypeInfo.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.823283000000Z
// 2016-02-26T11:37:22.609565000000Z

enum Range {
case Range(Range_Data)
Expand All @@ -20,7 +20,7 @@ enum TypeInfo {
}

enum CompileResult {
case CompileError(Array<TypeInfo>,Array<TypeInfo>)
case CompileError(Array<Range>,String,Array<TypeInfo>)
case Compiled(String,Pipeline,Array<TypeInfo>)
}

Expand Down Expand Up @@ -105,8 +105,8 @@ extension TypeInfo {
extension CompileResult {
var toJSON : [String: AnyObject] {
switch self {
case .CompileError(let arg0, let arg1):
return [ "tag" : "CompileError", "arg0" : arg0.toJSON, "arg1" : arg1.toJSON]
case .CompileError(let arg0, let arg1, let arg2):
return [ "tag" : "CompileError", "arg0" : arg0.toJSON, "arg1" : arg1.toJSON, "arg2" : arg2.toJSON]
case .Compiled(let arg0, let arg1, let arg2):
return [ "tag" : "Compiled", "arg0" : arg0.toJSON, "arg1" : arg1.toJSON, "arg2" : arg2.toJSON]
}
Expand Down
7 changes: 4 additions & 3 deletions ddl/out/LambdaCube.TypeInfo2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.823283000000Z
// 2016-02-26T11:37:22.609565000000Z

#ifndef HEADER_LambdaCube.TypeInfo_H
#define HEADER_LambdaCube.TypeInfo_H
Expand Down Expand Up @@ -41,8 +41,9 @@ class TypeInfo {
namespace data {
class CompileError {
public:
std::vector<std::shared_ptr<::TypeInfo>> _0;
std::vector<std::shared_ptr<::TypeInfo>> _1;
std::vector<std::shared_ptr<::Range>> _0;
String _1;
std::vector<std::shared_ptr<::TypeInfo>> _2;
};
class Compiled {
public:
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/TestData.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.839781000000Z
// 2016-02-26T11:37:22.627476000000Z

#include "TestData.hpp"
template<> json toJSON<std::shared_ptr<ClientInfo>>(std::shared_ptr<ClientInfo> &v) {
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/TestData.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.839781000000Z
// 2016-02-26T11:37:22.627476000000Z

#ifndef HEADER_TestData_H
#define HEADER_TestData_H
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/TestData.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.839781000000Z
-- 2016-02-26T11:37:22.627476000000Z

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module TestData where
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/TestData.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- generated file, do not modify!
-- 2016-02-26T11:29:11.839781000000Z
-- 2016-02-26T11:37:22.627476000000Z

module TestData where
import Prelude
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/TestData.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.839781000000Z
// 2016-02-26T11:37:22.627476000000Z

enum ClientInfo {
case ClientInfo(ClientInfo_Data)
Expand Down
2 changes: 1 addition & 1 deletion ddl/out/TestData2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated file, do not modify!
// 2016-02-26T11:29:11.839781000000Z
// 2016-02-26T11:37:22.627476000000Z

#ifndef HEADER_TestData_H
#define HEADER_TestData_H
Expand Down

0 comments on commit 2eb7cc7

Please sign in to comment.