forked from jnthn/6model
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add integer indexes for all the representations; put .class in the me…
…tatables (sorear++)
- Loading branch information
Showing
15 changed files
with
164 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,46 @@ | ||
|
|
||
| function makeKnowHOWREPR () | ||
| local KnowHOWREPR = {}; | ||
| local KnowHOWREPR = { ["class"] = "KnowHOWREPR" }; | ||
| local mt = { __index = KnowHOWREPR }; | ||
|
|
||
| local makeInstance = function () | ||
| local Instance = {}; | ||
| local Instance = { ["class"] = "KnowHOW" }; | ||
| local mt = { __index = Instance }; | ||
| function Instance.new(STable) | ||
| local instance = {}; | ||
| instance.STable = STable; | ||
| instance.class = "KnowHOW"; | ||
| return setmetatable(instance, mt); | ||
| local this = {}; | ||
| this.STable = STable; | ||
| return setmetatable(this, mt); | ||
| end | ||
| return Instance; | ||
| end | ||
| local Instance = makeInstance(); | ||
|
|
||
| function KnowHOWREPR.new() | ||
| local this = {}; | ||
| this.class = "KnowHOWREPR"; | ||
| return setmetatable(this, mt); | ||
| return setmetatable({}, mt); | ||
| end | ||
| KnowHOWREPR[1] = KnowHOWREPR.new; | ||
| function KnowHOWREPR:type_object_for(TC, MetaPackage) | ||
| local STable = SharedTable.new(); | ||
| STable.HOW = MetaPackage; | ||
| STable.REPR = self; | ||
| STable.WHAT = Instance.new(STable); | ||
| return STable.WHAT; | ||
| end | ||
| KnowHOWREPR[2] = KnowHOWREPR.type_object_for; | ||
| function KnowHOWREPR:instance_of(TC, WHAT) | ||
| local Object = Instance.new(WHAT.STable); | ||
| Object.Methods = {}; | ||
| Object.Attributes = List.new(); | ||
| return Object; | ||
| end | ||
| KnowHOWREPR[3] = KnowHOWREPR.instance_of; | ||
| function KnowHOWREPR:defined(TC, Obj) | ||
| if (Obj.Methods ~= nil) then | ||
| return true; | ||
| else | ||
| return false; | ||
| end | ||
| return Obj.Methods ~= nil; | ||
| end | ||
| KnowHOWREPR[4] = KnowHOWREPR.defined; | ||
| function KnowHOWREPR:hint_for(TC, ClassHandle, Name) | ||
| return Hints.NO_Hint; | ||
| end | ||
| KnowHOWREPR[5] = KnowHOWREPR.hint_for; | ||
| return KnowHOWREPR; | ||
| end | ||
| KnowHOWREPR = makeKnowHOWREPR(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,44 @@ | ||
|
|
||
| function makeP6capture () | ||
| local P6capture = {}; | ||
| local P6capture = { ["class"] = "P6captureREPR" }; | ||
| local mt = { __index = P6capture }; | ||
|
|
||
| local makeInstance = function () | ||
| local Instance = {}; | ||
| local Instance = { ["class"] = "P6capture"}; | ||
| local mt = { __index = Instance }; | ||
| function Instance.new(STable) | ||
| local instance = {}; | ||
| instance.STable = STable; | ||
| instance.class = "P6capture"; | ||
| return setmetatable(instance, mt); | ||
| local this = {}; | ||
| this.STable = STable; | ||
| return setmetatable(this, mt); | ||
| end | ||
| return Instance; | ||
| end | ||
| local Instance = makeInstance(); | ||
|
|
||
| function P6capture.new() | ||
| local this = {}; | ||
| this.class = "P6captureREPR"; | ||
| return setmetatable(this, mt); | ||
| end | ||
| P6capture[1] = P6capture.new; | ||
| function P6capture:type_object_for(TC, MetaPackage) | ||
| local STable = SharedTable.new(); | ||
| STable.HOW = MetaPackage; | ||
| STable.REPR = self; | ||
| STable.WHAT = Instance.new(STable); | ||
| return STable.WHAT; | ||
| end | ||
| P6capture[2] = P6capture.type_object_for; | ||
| function P6capture:instance_of(TC, WHAT) | ||
| return Instance.new(WHAT.STable); | ||
| end | ||
| P6capture[3] = P6capture.instance_of; | ||
| function P6capture:defined(TC, Obj) | ||
| if (Obj.Positionals ~= nil or Obj.Nameds ~= nil) then | ||
| return true; | ||
| else | ||
| return false; | ||
| end | ||
| return Obj.Positionals ~= nil or Obj.Nameds ~= nil; | ||
| end | ||
| P6capture[4] = P6capture.defined; | ||
| function P6capture:hint_for(TC, ClassHandle, Name) | ||
| return Hints.NO_HINT; | ||
| end | ||
| P6capture[5] = P6capture.hint_for; | ||
| return P6capture; | ||
| end | ||
| P6capture = makeP6capture(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,68 @@ | ||
|
|
||
| function makeP6hash () | ||
| local P6hash = {}; | ||
| local P6hash = { ["class"] = "P6hashREPR" }; | ||
| local mt = { __index = P6hash }; | ||
|
|
||
| -- inner class | ||
| local makeInstance = function () | ||
| local Instance = {}; | ||
| local Instance = { ["class"] = "P6hash" }; | ||
| local mt = { __index = Instance }; | ||
| function Instance.new(STable) | ||
| local instance = {}; | ||
| instance.STable = STable; | ||
| instance.class = "P6hash"; | ||
| return setmetatable(instance, mt); | ||
| local this = {}; | ||
| this.STable = STable; | ||
| return setmetatable(this, mt); | ||
| end | ||
| return Instance; | ||
| end | ||
| local Instance = makeInstance(); | ||
|
|
||
| function P6hash.new() | ||
| local this = {}; | ||
| this.class = "P6hashREPR"; | ||
| return setmetatable(this, mt); | ||
| return setmetatable({}, mt); | ||
| end | ||
| P6hash[1] = P6hash.new; | ||
| function P6hash:type_object_for(TC, MetaPackage) | ||
| local STable = SharedTable.new(); | ||
| STable.HOW = MetaPackage; | ||
| STable.REPR = self; | ||
| STable.WHAT = Instance.new(STable); | ||
| return STable.WHAT; | ||
| end | ||
| P6hash[2] = P6hash.type_object_for; | ||
| function P6hash:instance_of(TC, WHAT) | ||
| local Object = Instance.new(WHAT.STable); | ||
| Object.Storage = {}; | ||
| return Object; | ||
| end | ||
| P6hash[3] = P6hash.instance_of; | ||
| function P6hash:defined(TC, O) | ||
| return O.Storage ~= nil; | ||
| end | ||
| P6hash[4] = P6hash.defined; | ||
| function P6hash:hint_for(TC, ClassHandle, Name) | ||
| return Hints.NO_HINT; | ||
| end | ||
| P6hash[5] = P6hash.hint_for; | ||
| function P6hash:get_attribute(TC, I, ClassHandle, Name) | ||
| if (I.Storage ~= nil or I.Storage[ClassHandle] == nil) then | ||
| return nil; | ||
| end | ||
| return I.Storage[ClassHandle][Name]; | ||
| end | ||
| P6hash[6] = P6hash.get_attribute; | ||
| function P6hash:get_attribute_with_hint(TC, I, ClassHandle, Name, Hint) | ||
| return self:get_attribute(TC, Object, ClassHandle, Name); | ||
| end | ||
| P6hash[7] = P6hash.get_attribute_with_hint; | ||
| function P6hash:bind_attribute(TC, Object, ClassHandle, Name, Value) | ||
| Object.Storage = Object.Storage or {}; | ||
| local ClassStore = Object.Storage[ClassHandle] or {}; | ||
| Object.Storage[ClassHandle] = ClassStore; | ||
| ClassStore[Name] = Value; | ||
| end | ||
| P6hash[8] = P6hash.bind_attribute; | ||
| function P6hash:bind_attribute_with_hint(TC, Object, ClassHandle, Name, Hint, Value) | ||
| self:bind_attribute(TC, Object, ClassHandle, Name, Value); | ||
| end | ||
| function P6hash:hint_for(TC, ClassHandle, Name) | ||
| return Hints.NO_HINT; | ||
| end | ||
| P6hash[9] = P6hash.bind_attribute_with_hint; | ||
| return P6hash; | ||
| end | ||
| P6hash = makeP6hash(); |
Oops, something went wrong.