UNPKG

minigrace

Version:

A compiler for the Grace programming language

931 lines (930 loc) 134 kB
let gracecode_option_sourceFile = "/Users/black/Development/mg/gracelang/minigrace/modules/option.grace"; let gracecode_option_sha256 = "b027917d5bbf2053b2da4834809fc7e79106d7005f50a6c1fdea83b5398a4b13"; let gracecode_option_minigraceRevision = "b57591d29fc5ee5270d114920bf671367b8c3ecb"; let gracecode_option_minigraceGeneration = "5171"; if (typeof gctCache !== "undefined") gctCache["option"] = "dialect:\n standard\nfreshScopes:\n $100 trait\n $103\n $104 trait\n $105\n $106 trait\nmethodTypes:$100:\n do(_:Unknown) \u2192 Done\n fifth \u2192 T\n first \u2192 T\n fourth \u2192 T\n last \u2192 T\n reversed \u2192 Option\u27e6T\u27e7\n second \u2192 T\n size \u2192 Number\n sizeIfUnknown(_:Unknown) \u2192 Number\n sorted \u2192 Option\u27e6T\u27e7\n sortedBy(_:Unknown) \u2192 Option\u27e6T\u27e7\n third \u2192 T\n value \u2192 T\n values \u2192 Option\u27e6T\u27e7\nmethodTypes:$102:\n empty\u27e6T\u27e7 \u2192 Option\n full\u27e6T\u27e7(contents:T) \u2192 Option\nmethodTypes:$103:\n ++(other:Collection\u27e6T\u27e7) \u2192 Collection\u27e6T\u27e7\n do(action:Function1\u27e6T, Done\u27e7) \u2192 Done\n filter(condition:Function1\u27e6T, Boolean\u27e7) \u2192 Collection\u27e6T\u27e7\n fold(binaryFunction:Function2\u27e6T, T, T\u27e7)startingWith(initial:T) \u2192 T\n ifEmpty(eAction:Function0\u27e6Done\u27e7) \u2192 Done\n ifEmpty\u27e6U\u27e7(eAction:Function0\u27e6U\u27e7)ifFull(fAction:Function1\u27e6T, U\u27e7) \u2192 U\n ifFull(fAction:Function1\u27e6T, Done\u27e7) \u2192 Done\n ifFull\u27e6U\u27e7(fAction:Function1\u27e6T, U\u27e7)ifEmpty(eAction:Function0\u27e6U\u27e7) \u2192 U\n indexOf(sought:T) \u2192 Number\n indexOf\u27e6W\u27e7(sought:T)ifAbsent(action:Function0\u27e6W\u27e7) \u2192 W\n isEmpty \u2192 Boolean\n isFull \u2192 Boolean\n keysAndValuesDo(action:Function2\u27e6Number, T, Object\u27e7) \u2192 Done\n map\u27e6U\u27e7(function:Function1\u27e6T, U\u27e7) \u2192 Option\u27e6U\u27e7\n size \u2192 Number\nmethodTypes:$104:\n ++(other:Collection\u27e6T\u27e7) \u2192 Collection\u27e6T\u27e7\n do(action:Function1\u27e6T, Done\u27e7) \u2192 Done\n filter(condition:Function1\u27e6T, Boolean\u27e7) \u2192 Collection\u27e6T\u27e7\n fold(binaryFunction:Function2\u27e6T, T, T\u27e7)startingWith(initial:T) \u2192 T\n ifEmpty(eAction:Function0\u27e6Done\u27e7) \u2192 Done\n ifEmpty\u27e6U\u27e7(eAction:Function0\u27e6U\u27e7)ifFull(fAction:Function1\u27e6T, U\u27e7) \u2192 U\n ifFull(fAction:Function1\u27e6T, Done\u27e7) \u2192 Done\n ifFull\u27e6U\u27e7(fAction:Function1\u27e6T, U\u27e7)ifEmpty(eAction:Function0\u27e6U\u27e7) \u2192 U\n indexOf(sought:T) \u2192 Number\n indexOf\u27e6W\u27e7(elem:T)ifAbsent(action:Function0\u27e6W\u27e7) \u2192 W\n isEmpty \u2192 Boolean\n isFull \u2192 Boolean\n keysAndValuesDo(action:Function2\u27e6Number, T, Object\u27e7) \u2192 Done\n map\u27e6U\u27e7(function:Function1\u27e6T, U\u27e7) \u2192 Option\u27e6U\u27e7\n size \u2192 Number\n value \u2192 T\n valueIfEmpty(eValue:Function0) \u2192 Unknown\nmodules:\n collections\n standard\npath:\n /Users/black/Development/mg/gracelang/minigrace/modules/option.grace\nscope:$100:\n <<(1) Unknown (mth) $scope_done\n >>(1) Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString String (go) $scope_string\n basicAsString String (go) $scope_string\n do(1) Done (req) $scopeUniv required\n do(1)separatedBy(1) Unknown (mth) $scope_done\n fifth T (mth) $scope_done\n first T (req) $scopeUniv required\n fourth T (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n last T (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n reversed Option (mth) $scope_done\n second T (mth) $scope_done\n size Number (req) $scopeUniv required\n sizeIfUnknown(1) Number (mth) $scope_done\n sorted Option (mth) $scope_done\n sortedBy(1) Option (mth) $scope_done\n third T (mth) $scope_done\n value T (req) $scopeUniv required\n values Option (mth) $scope_done\nscope:$102:\n Option type\n ValueError Unknown (def) $scope_done public\n asDebugString String (go) $scope_string\n asString String (go) $scope_string\n basicAsString String (go) $scope_string\n empty Option (mth) $104\n full(1) Option (mth) $103\n isMe(1) Boolean (go) $scope_boolean\n myIdentityHash Number (go) $scope_number\n optionAsCollection Unknown (mth) $100\nscope:$103:\n ++(1) Collection (mth) $scope_done\n ::(1) Unknown (mth) $scope_done\n <<(1) Unknown (mth) $scope_done\n ==(1) Unknown (mth) $scope_done\n >>(1) Unknown (mth) $scope_done\n allSatisfy(1) Unknown (mth) $scope_done\n anySatisfy(1) Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n at(1) Unknown (mth) $scope_done\n at(1)ifAbsent(1) Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n contains(1) Unknown (mth) $scope_done\n do(1) Done (mth) $scope_done\n do(1)separatedBy(1) Unknown (mth) $scope_done\n fifth T (mth) $scope_done\n filter(1) Collection (mth) $scope_done\n first Unknown (mth) $scope_done\n fold(1)startingWith(1) T (mth) $scope_done\n fourth T (mth) $scope_done\n hash Unknown (req) $scopeUniv\n ifEmpty(1) Done (mth) $scope_done\n ifEmpty(1)ifFull(1) U (mth) $scope_done\n ifFull(1) Done (mth) $scope_done\n ifFull(1)ifEmpty(1) U (mth) $scope_done\n indexOf(1) Number (mth) $scope_done\n indexOf(1)ifAbsent(1) W (mth) $scope_done\n indices Unknown (mth) $scope_done\n isEmpty Boolean (mth) $scope_done\n isFull Boolean (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n iterator Unknown (mth) $105\n keys Unknown (mth) $scope_done\n keysAndValuesDo(1) Done (mth) $scope_done\n last T (mth) $scope_done\n map(1) Option (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n prefix== Unknown (mth) $scope_done\n prefix\u2260 Unknown (mth) $scope_done\n reversed Option (mth) $scope_done\n second T (mth) $scope_done\n size Number (mth) $scope_done\n sizeIfUnknown(1) Unknown (mth) $scope_done\n sorted Option (mth) $scope_done\n sortedBy(1) Option (mth) $scope_done\n third T (mth) $scope_done\n value Unknown (def) $scopeEmpty public\n valueIfEmpty(1) Unknown (mth) $scope_done\n values Option (mth) $scope_done\n \u2260(1) Unknown (mth) $scope_done\nscope:$104:\n ++(1) Collection (mth) $scope_done\n ::(1) Unknown (mth) $scope_done\n <<(1) Unknown (mth) $scope_done\n ==(1) Unknown (mth) $scope_done\n >>(1) Unknown (mth) $scope_done\n allSatisfy(1) Unknown (mth) $scope_done\n anySatisfy(1) Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n at(1) Unknown (mth) $scope_done\n at(1)ifAbsent(1) Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n contains(1) Unknown (mth) $scope_done\n do(1) Done (mth) $scope_done\n do(1)separatedBy(1) Unknown (mth) $scope_done\n fifth T (mth) $scope_done\n filter(1) Collection (mth) $scope_done\n first Unknown (mth) $scope_done\n fold(1)startingWith(1) T (mth) $scope_done\n fourth T (mth) $scope_done\n hash Unknown (req) $scopeUniv\n ifEmpty(1) Done (mth) $scope_done\n ifEmpty(1)ifFull(1) U (mth) $scope_done\n ifFull(1) Done (mth) $scope_done\n ifFull(1)ifEmpty(1) U (mth) $scope_done\n indexOf(1) Number (mth) $scope_done\n indexOf(1)ifAbsent(1) W (mth) $scope_done\n indices Unknown (mth) $scope_done\n isEmpty Boolean (mth) $scope_done\n isFull Boolean (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n iterator Unknown (mth) $106\n keys Unknown (mth) $scope_done\n keysAndValuesDo(1) Done (mth) $scope_done\n last T (mth) $scope_done\n map(1) Option (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n prefix== Unknown (mth) $scope_done\n prefix\u2260 Unknown (mth) $scope_done\n reversed Option (mth) $scope_done\n second T (mth) $scope_done\n size Number (mth) $scope_done\n sizeIfUnknown(1) Unknown (mth) $scope_done\n sorted Option (mth) $scope_done\n sortedBy(1) Option (mth) $scope_done\n third T (mth) $scope_done\n value T (mth) $scope_done\n valueIfEmpty(1) Unknown (mth) $scope_done\n values Option (mth) $scope_done\n \u2260(1) Unknown (mth) $scope_done\nscope:$105:\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n hasNext Unknown (var) $scopeEmpty readable\n hasNext:=(1) Unknown (var) $scopeEmpty readable\n isMe(1) Boolean (go) $scope_boolean\n myIdentityHash Number (go) $scope_number\n next Unknown (mth) $scope_done\nscope:$106:\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n hasNext Unknown (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n myIdentityHash Number (go) $scope_number\n next Unknown (mth) $scope_done\nself:\n $102\ntypedec:$102.Option:\n type Option\u27e6T\u27e7 = Collection\u27e6T\u27e7 & interface {\n value \u2192 T\n valueIfEmpty\u27e6U\u27e7(eValue:Function0\u27e6U\u27e7) \u2192 T | U\n iterator \u2192 Iterator\n isFull \u2192 Boolean\n isEmpty \u2192 Boolean\n ifFull\u27e6U\u27e7(fAction:Function1\u27e6T, U\u27e7)ifEmpty(eAction:Function0\u27e6U\u27e7) \u2192 U\n ifEmpty\u27e6U\u27e7(eAction:Function0\u27e6U\u27e7)ifFull(fAction:Function1\u27e6T, U\u27e7) \u2192 U\n ifFull(fAction:Function1\u27e6T, Done\u27e7) \u2192 Done\n ifEmpty(eAction:Function0\u27e6Done\u27e7) \u2192 Done}\ntypes:\n $102.Option\n"; if (typeof originalSourceLines !== "undefined") { originalSourceLines["option"] = [ "dialect \"standard\"", "import \"collections\" as collections", "", "type Option⟦T⟧ = Collection⟦T⟧ & interface {", " value → T", " valueIfEmpty⟦U⟧ (eValue:Function0⟦U⟧) → T | U", " iterator → Iterator", " isFull → Boolean", " isEmpty → Boolean", " ifFull⟦U⟧ (fAction:Function1⟦T, U⟧) ifEmpty (eAction:Function0⟦U⟧) → U", " ifEmpty⟦U⟧ (eAction:Function0⟦U⟧) ifFull (fAction:Function1⟦T, U⟧) → U", " ifFull (fAction:Function1⟦T, Done⟧) → Done", " ifEmpty (eAction:Function0⟦Done⟧) → Done", "}", "", "def ValueError is public = ProgrammingError.refine \"ValueError\"", "", "trait optionAsCollection⟦T⟧ {", " method value → T is required", " method do(_) → Done is required", " method size → Number is required", " method first → T is required", " method sizeIfUnknown(_) → Number { size }", " method do (action) separatedBy (_) { do(action) }", " method sorted → Option⟦T⟧ { self }", " method sortedBy(_) → Option⟦T⟧ { self }", " method values → Option⟦T⟧ { self }", " method second -> T { BoundsError.raise \"attemp to use second on {self}.\" }", " method third -> T { BoundsError.raise \"attemp to use third on {self}.\" }", " method fourth -> T { BoundsError.raise \"attemp to use fourth on {self}.\" }", " method fifth -> T { BoundsError.raise \"attemp to use fifth on {self}.\" }", " method last -> T { first }", " method reversed → Option⟦T⟧ { self }", " method >>(target) { target << self }", " method <<(source) { self ++ source }", "}", "class full⟦T⟧(contents:T) → Option {", " use optionAsCollection⟦T⟧", " use equality", " def value is public = contents", " method valueIfEmpty(_) { value }", " method asString { \"option.full({value})\" }", " method first { value }", " method do(action:Function1⟦T, Done⟧) → Done { action.apply(value) }", " method keysAndValuesDo(action:Function2⟦Number,T,Object⟧) -> Done { action.apply(1, value) }", " method contains(v) { value == v }", " method anySatisfy(predicate) { predicate.apply(value) }", " method allSatisfy(predicate) { predicate.apply(value) }", " method indices { sequence [1] }", " method keys { sequence [1] }", " method ==(other) {", " match (other) ", " case {c:Collection → (c.size == 1) && {c.first == value} }", " else {false}", " }", " class iterator {", " var hasNext is readable := true", " method asString { \"iterator over {self}\" }", " method next {", " if (hasNext) then { ", " hasNext := false", " value", " } else { ", " IteratorExhausted.raise \"{self} contains just one value.\"", " }", " }", " } ", " method isEmpty → Boolean { false }", " method size → Number { 1 }", " method sizeIfUnknown(action) { 1 }", " method at(ix) { ", " if (ix == 1) then { ", " value ", " } else { ", " BoundsError.raise \"attemp to use index {ix} on {self}.\"", " }", " }", " method at(ix) ifAbsent(action) {", " if (ix == 1) then {", " value", " } else {", " action.apply", " }", " }", " method isFull → Boolean { true }", " method ifFull⟦U⟧ (fAction:Function1⟦T, U⟧) ifEmpty (eAction:Function0⟦U⟧) → U {", " fAction.apply(value)", " }", " method ifEmpty⟦U⟧ (eAction:Function0⟦U⟧) ifFull (fAction:Function1⟦T, U⟧) → U {", " fAction.apply(value)", " }", " method ifFull (fAction:Function1⟦T, Done⟧) → Done {", " fAction.apply(value)", " done", " }", " method ifEmpty (eAction:Function0⟦Done⟧) → Done { done }", " method indexOf⟦W⟧ (sought:T) ifAbsent (action:Function0⟦W⟧) -> W { ", " if (value == sought) then { 1 }", " else { action.apply }", " }", " method indexOf(sought:T) -> Number { ", " if (value == sought) then { 1 }", " else { NoSuchObject.raise \"collection does not contain {sought}\" }", " }", " method ++(other: Collection⟦T⟧) -> Collection⟦T⟧ { ", " collections.lazyConcatenation(self, other)", " }", " method fold(binaryFunction:Function2⟦T, T, T⟧) startingWith(initial:T) -> T {", " binaryFunction.apply(initial, value)", " }", " method map⟦U⟧(function:Function1⟦T, U⟧) -> Option⟦U⟧ {", " full(function.apply(value))", " }", " method filter(condition:Function1⟦T,Boolean⟧) -> Collection⟦T⟧ {", " if (condition.apply(value)) then { self } else { empty⟦T⟧ }", " }", "}", "class empty⟦T⟧ → Option {", " use optionAsCollection⟦T⟧", " use equality", " method asString { \"option.empty\" }", " method value → T { ValueError.raise \"{self} has no value.\" }", " method valueIfEmpty(eValue:Function0) { eValue.apply }", " method first { BoundsError.raise \"{self} is empty.\" }", " method do(action:Function1⟦T, Done⟧) → Done { done }", " method keysAndValuesDo(action:Function2⟦Number,T,Object⟧) -> Done { done }", " method contains(_) { false }", " method anySatisfy(_) { false }", " method allSatisfy(_) { true }", " method indices { [] }", " method keys { [] }", " method ==(other) {", " match (other) ", " case {c:Collection → c.isEmpty}", " else {false}", " }", " class iterator {", " method hasNext { false }", " method asString { \"iterator over {self}\" }", " method next { IteratorExhausted.raise \"{self} contains no values.\" }", " }", " method isEmpty → Boolean { true }", " method size → Number { 0 }", " method sizeIfUnknown(action) { 0 }", " method at(ix) { ", " BoundsError.raise \"attemp to use index {ix} on {self}.\"", " }", " method at(ix) ifAbsent(action) {", " action.apply", " }", " method isFull → Boolean { false }", " method ifFull⟦U⟧ (fAction:Function1⟦T, U⟧) ifEmpty (eAction:Function0⟦U⟧) → U {", " eAction.apply", " }", " method ifEmpty⟦U⟧ (eAction:Function0⟦U⟧) ifFull (fAction:Function1⟦T, U⟧) → U {", " eAction.apply", " }", " method ifFull (fAction:Function1⟦T, Done⟧) → Done { done }", " method ifEmpty (eAction:Function0⟦Done⟧) → Done {", " eAction.apply", " done", " }", " method indexOf⟦W⟧ (elem:T) ifAbsent (action:Function0⟦W⟧) -> W { action.apply }", " method indexOf(sought:T) -> Number { NoSuchObject.raise \"collection does not contain {sought}\" }", " method ++(other: Collection⟦T⟧) -> Collection⟦T⟧ { other }", " method fold (binaryFunction:Function2⟦T, T, T⟧) startingWith(initial:T) -> T {", " initial", " }", " method map⟦U⟧ (function:Function1⟦T, U⟧) -> Option⟦U⟧ { empty⟦U⟧ }", " method filter (condition:Function1⟦T,Boolean⟧) -> Collection⟦T⟧ { self }", "}" ]; } function gracecode_option() { importedModules["option"] = this; const var_$module = this; this.definitionModule = "option"; this.definitionLine = 1; setLineNumber(1); // compilenode dialect // Dialect "standard" const var_$dialect = do_import("standard", gracecode_standard); this.outer = var_$dialect; setLineNumber(2); // compilenode import // Import of "collections" as collections if (typeof gracecode_collections == "undefined") throw new GraceExceptionPacket(EnvironmentExceptionObject, new GraceString("could not find module collections")); var var_collections = do_import("collections", gracecode_collections); var func0 = function(argcv) { // accessor method collections, line 2 const numArgs = arguments.length - 1; if (numArgs > 0) raiseTypeArgError("collections", 0, numArgs - 0); return var_collections; }; // end of method collections this.methods["collections"] = func0; func0.methodName = "collections"; func0.paramCounts = [0]; func0.paramNames = []; func0.definitionLine = 2; func0.definitionModule = "option"; func0.debug = "import"; func0.confidential = true; this.closureKeys = this.closureKeys || []; this.closureKeys.push("outer_option_1"); this.outer_option_1 = var_$dialect; setLineNumber(4); // compilenode typedec // Type decl Option var func2 = function(argcv, var_T) { // method Option, line 1 var returnTarget = invocationCount; invocationCount++; setLineNumber(1); // compilenode string var string4 = new GraceString("Option"); // call case 4: other requests setLineNumber(4); // compilenode interfaceliteral // interface literal var iface6 = new GraceInterface("\u2039anon\u203a"); sig7 = () => { return new GraceSignature("value", [], [], [], var_T); } sig8 = (var_U) => { setLineNumber(6); // compilenode member var call9 = selfRequest(var_$dialect, "Function0", [0]); // call case 4: other requests var term10 = request(var_T, "|(1)", [1], var_U); return new GraceSignature("valueIfEmpty(1)", ["eValue"], ["U"], [call9], term10); } sig11 = () => { setLineNumber(7); // compilenode member var call12 = selfRequest(var_$dialect, "Iterator", [0]); return new GraceSignature("iterator", [], [], [], call12); } sig13 = () => { setLineNumber(8); // compilenode member var call14 = selfRequest(var_$dialect, "Boolean", [0]); return new GraceSignature("isFull", [], [], [], call14); } sig15 = () => { setLineNumber(9); // compilenode member var call16 = selfRequest(var_$dialect, "Boolean", [0]); return new GraceSignature("isEmpty", [], [], [], call16); } sig17 = (var_U) => { setLineNumber(10); // compilenode member var call18 = selfRequest(var_$dialect, "Function1", [0]); var call19 = selfRequest(var_$dialect, "Function0", [0]); return new GraceSignature("ifFull(1)ifEmpty(1)", ["fAction", "eAction"], ["U"], [call18, call19], var_U); } sig20 = (var_U) => { setLineNumber(11); // compilenode member var call21 = selfRequest(var_$dialect, "Function0", [0]); var call22 = selfRequest(var_$dialect, "Function1", [0]); return new GraceSignature("ifEmpty(1)ifFull(1)", ["eAction", "fAction"], ["U"], [call21, call22], var_U); } sig23 = () => { setLineNumber(12); // compilenode member var call24 = selfRequest(var_$dialect, "Function1", [0]); var call25 = selfRequest(var_$dialect, "Done", [0]); return new GraceSignature("ifFull(1)", ["fAction"], [], [call24], call25); } sig26 = () => { setLineNumber(13); // compilenode member var call27 = selfRequest(var_$dialect, "Function0", [0]); var call28 = selfRequest(var_$dialect, "Done", [0]); return new GraceSignature("ifEmpty(1)", ["eAction"], [], [call27], call28); } iface6.typeMethods = { "value": sig7 , "valueIfEmpty(1)": sig8 , "iterator": sig11 , "isFull": sig13 , "isEmpty": sig15 , "ifFull(1)ifEmpty(1)": sig17 , "ifEmpty(1)ifFull(1)": sig20 , "ifFull(1)": sig23 , "ifEmpty(1)": sig26 }; // call case 4: other requests setLineNumber(4); // compilenode member var call29 = selfRequest(var_$dialect, "Collection", [0]); var term5 = request(call29, "&(1)", [1], iface6); var call3 = selfRequest(term5, "setTypeName(1)", [1], string4); return call3; }; // end of method Option function memofunc2(argcv, var_T) { if (! var_T) var_T = type_Unknown; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 1)) { raiseTypeArgError("Option", 1, numArgs - 0); } let memoTable = this.data["memo$Option"] || ( this.data["memo$Option"] = request(var_HashMap, 'empty', [0]) ); let tableKey = var_T; let absentBlock = new GraceBlock(this, 1, 0); absentBlock.guard = jsTrue; absentBlock.real = function ifAbsentBlock() { let newResult = func2.call(this, argcv, var_T); request(memoTable, 'at(1)put(1)', [1,1], tableKey, newResult); return newResult; }; absentBlock.methods.apply = function apply (argcv) { return this.real.apply(this.receiver); }; return request(memoTable, 'at(1)ifAbsent(1)', [1,1], tableKey, absentBlock); }; this.methods["Option"] = memofunc2; memofunc2.methodName = "Option"; memofunc2.paramCounts = [0]; memofunc2.paramNames = []; memofunc2.typeParamNames = ["T"]; memofunc2.definitionLine = 1; memofunc2.definitionModule = "option"; func2.methodName = "Option"; func2.paramCounts = [0]; func2.paramNames = []; func2.typeParamNames = ["T"]; func2.definitionLine = 1; func2.definitionModule = "option"; var func30 = function(argcv, var_T) { // method optionAsCollection, line 18 var returnTarget = invocationCount; invocationCount++; if (! var_T) var_T = type_Unknown; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 1)) { raiseTypeArgError("optionAsCollection", 1, numArgs - 0); } var ouc = emptyGraceObject("optionAsCollection", "option", 18); var ouc_init = this.methods["optionAsCollection$build(3)"].call(this, null, ouc, [], [], var_T); ouc_init.call(ouc); return ouc; }; // end of method optionAsCollection this.methods["optionAsCollection"] = func30; func30.methodName = "optionAsCollection"; func30.paramCounts = [0]; func30.paramNames = []; func30.typeParamNames = ["T"]; func30.definitionLine = 18; func30.definitionModule = "option"; var func31 = function(argcv, inheritingObject, aliases, exclusions, var_T) { // method optionAsCollection$build(_,_,_), line 18 var returnTarget = invocationCount; invocationCount++; if (! var_T) var_T = type_Unknown; const numArgs = arguments.length - 4; if ((numArgs > 0) && (numArgs !== 1)) { raiseTypeArgError("optionAsCollection", 1, numArgs - 0); } var obj32_build = function(ignore, outerObj, aliases, exclusions, var_T) { this.closureKeys = this.closureKeys || []; this.closureKeys.push("outer_option_18"); this.outer_option_18 = outerObj; const inheritedExclusions = { }; for (var eix = 0, eLen = exclusions.length; eix < eLen; eix ++) { const exMeth = exclusions[eix]; inheritedExclusions[exMeth] = this.methods[exMeth]; }; if (! this.methods["value"]) { var func33 = function(argcv) { // method value, line 19 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("value", 0, numArgs - 0); } setLineNumber(19); // required method throw new GraceExceptionPacket(ProgrammingErrorObject, new GraceString("required method value " + "was not supplied for " + safeJsString(this))); }; // end of method value func33.returnType = var_T; this.methods["value"] = func33; func33.methodName = "value"; func33.paramCounts = [0]; func33.paramNames = []; func33.definitionLine = 19; func33.definitionModule = "option"; }; if (! this.methods["do(1)"]) { var func34 = function(argcv, var___95____95__1) { // method do(_), line 20 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("do(_)", 0, numArgs - 1); } setLineNumber(20); // required method throw new GraceExceptionPacket(ProgrammingErrorObject, new GraceString("required method do(_) " + "was not supplied for " + safeJsString(this))); }; // end of method do(_) var call35 = selfRequest(var_$dialect, "Done", [0]); func34.returnType = call35; this.methods["do(1)"] = func34; func34.methodName = "do(1)"; func34.paramCounts = [1]; func34.paramNames = ["__1"]; func34.definitionLine = 20; func34.definitionModule = "option"; }; if (! this.methods["size"]) { var func36 = function(argcv) { // method size, line 21 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("size", 0, numArgs - 0); } setLineNumber(21); // required method throw new GraceExceptionPacket(ProgrammingErrorObject, new GraceString("required method size " + "was not supplied for " + safeJsString(this))); }; // end of method size var call37 = selfRequest(var_$dialect, "Number", [0]); func36.returnType = call37; this.methods["size"] = func36; func36.methodName = "size"; func36.paramCounts = [0]; func36.paramNames = []; func36.definitionLine = 21; func36.definitionModule = "option"; }; if (! this.methods["first"]) { var func38 = function(argcv) { // method first, line 22 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("first", 0, numArgs - 0); } setLineNumber(22); // required method throw new GraceExceptionPacket(ProgrammingErrorObject, new GraceString("required method first " + "was not supplied for " + safeJsString(this))); }; // end of method first func38.returnType = var_T; this.methods["first"] = func38; func38.methodName = "first"; func38.paramCounts = [0]; func38.paramNames = []; func38.definitionLine = 22; func38.definitionModule = "option"; }; var func39 = function(argcv, var___95____95__2) { // method sizeIfUnknown(_), line 23 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("sizeIfUnknown(_)", 0, numArgs - 1); } setLineNumber(23); // compilenode member var call40 = selfRequest(this, "size", [0]); var call41 = selfRequest(var_$dialect, "Number", [0]); assertTypeOrMsg(call40, call41, "result of method sizeIfUnknown(_)", "Number"); return call40; }; // end of method sizeIfUnknown(_) var call42 = selfRequest(var_$dialect, "Number", [0]); func39.returnType = call42; this.methods["sizeIfUnknown(1)"] = func39; func39.methodName = "sizeIfUnknown(1)"; func39.paramCounts = [1]; func39.paramNames = ["__2"]; func39.definitionLine = 23; func39.definitionModule = "option"; var func43 = function(argcv, var_action, var___95____95__3) { // method do(_)separatedBy(_), line 24 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 2) && (numArgs !== 2)) { raiseTypeArgError("do(_)separatedBy(_)", 0, numArgs - 2); } setLineNumber(24); // compilenode call var call44 = selfRequest(this, "do(1)", [1], var_action); return call44; }; // end of method do(_)separatedBy(_) this.methods["do(1)separatedBy(1)"] = func43; func43.methodName = "do(1)separatedBy(1)"; func43.paramCounts = [1, 1]; func43.paramNames = ["action", "__3"]; func43.definitionLine = 24; func43.definitionModule = "option"; var func45 = function(argcv) { // method sorted, line 25 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("sorted", 0, numArgs - 0); } setLineNumber(25); // compilenode member var call46 = selfRequest(var_$module, "Option", [0]); assertTypeOrMsg(this, call46, "result of method sorted", "Option"); return this; }; // end of method sorted var call47 = selfRequest(var_$module, "Option", [0]); func45.returnType = call47; this.methods["sorted"] = func45; func45.methodName = "sorted"; func45.paramCounts = [0]; func45.paramNames = []; func45.definitionLine = 25; func45.definitionModule = "option"; var func48 = function(argcv, var___95____95__4) { // method sortedBy(_), line 26 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("sortedBy(_)", 0, numArgs - 1); } setLineNumber(26); // compilenode member var call49 = selfRequest(var_$module, "Option", [0]); assertTypeOrMsg(this, call49, "result of method sortedBy(_)", "Option"); return this; }; // end of method sortedBy(_) var call50 = selfRequest(var_$module, "Option", [0]); func48.returnType = call50; this.methods["sortedBy(1)"] = func48; func48.methodName = "sortedBy(1)"; func48.paramCounts = [1]; func48.paramNames = ["__4"]; func48.definitionLine = 26; func48.definitionModule = "option"; var func51 = function(argcv) { // method values, line 27 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("values", 0, numArgs - 0); } setLineNumber(27); // compilenode member var call52 = selfRequest(var_$module, "Option", [0]); assertTypeOrMsg(this, call52, "result of method values", "Option"); return this; }; // end of method values var call53 = selfRequest(var_$module, "Option", [0]); func51.returnType = call53; this.methods["values"] = func51; func51.methodName = "values"; func51.paramCounts = [0]; func51.paramNames = []; func51.definitionLine = 27; func51.definitionModule = "option"; var func54 = function(argcv) { // method second, line 28 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("second", 0, numArgs - 0); } setLineNumber(28); // compilenode string var string57 = new GraceString("."); // call case 4: other requests // call case 4: other requests var string59 = new GraceString("attemp to use second on "); var concat58 = request(string59, "++(1)", [1], this); var concat56 = request(concat58, "++(1)", [1], string57); // call case 4: other requests var call60 = selfRequest(var_$dialect, "BoundsError", [0]); var call55 = request(call60, "raise(1)", [1], concat56); assertTypeOrMsg(call55, var_T, "result of method second", "T"); return call55; }; // end of method second func54.returnType = var_T; this.methods["second"] = func54; func54.methodName = "second"; func54.paramCounts = [0]; func54.paramNames = []; func54.definitionLine = 28; func54.definitionModule = "option"; var func61 = function(argcv) { // method third, line 29 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("third", 0, numArgs - 0); } setLineNumber(29); // compilenode string var string64 = new GraceString("."); // call case 4: other requests // call case 4: other requests var string66 = new GraceString("attemp to use third on "); var concat65 = request(string66, "++(1)", [1], this); var concat63 = request(concat65, "++(1)", [1], string64); // call case 4: other requests var call67 = selfRequest(var_$dialect, "BoundsError", [0]); var call62 = request(call67, "raise(1)", [1], concat63); assertTypeOrMsg(call62, var_T, "result of method third", "T"); return call62; }; // end of method third func61.returnType = var_T; this.methods["third"] = func61; func61.methodName = "third"; func61.paramCounts = [0]; func61.paramNames = []; func61.definitionLine = 29; func61.definitionModule = "option"; var func68 = function(argcv) { // method fourth, line 30 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("fourth", 0, numArgs - 0); } setLineNumber(30); // compilenode string var string71 = new GraceString("."); // call case 4: other requests // call case 4: other requests var string73 = new GraceString("attemp to use fourth on "); var concat72 = request(string73, "++(1)", [1], this); var concat70 = request(concat72, "++(1)", [1], string71); // call case 4: other requests var call74 = selfRequest(var_$dialect, "BoundsError", [0]); var call69 = request(call74, "raise(1)", [1], concat70); assertTypeOrMsg(call69, var_T, "result of method fourth", "T"); return call69; }; // end of method fourth func68.returnType = var_T; this.methods["fourth"] = func68; func68.methodName = "fourth"; func68.paramCounts = [0]; func68.paramNames = []; func68.definitionLine = 30; func68.definitionModule = "option"; var func75 = function(argcv) { // method fifth, line 31 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("fifth", 0, numArgs - 0); } setLineNumber(31); // compilenode string var string78 = new GraceString("."); // call case 4: other requests // call case 4: other requests var string80 = new GraceString("attemp to use fifth on "); var concat79 = request(string80, "++(1)", [1], this); var concat77 = request(concat79, "++(1)", [1], string78); // call case 4: other requests var call81 = selfRequest(var_$dialect, "BoundsError", [0]); var call76 = request(call81, "raise(1)", [1], concat77); assertTypeOrMsg(call76, var_T, "result of method fifth", "T"); return call76; }; // end of method fifth func75.returnType = var_T; this.methods["fifth"] = func75; func75.methodName = "fifth"; func75.paramCounts = [0]; func75.paramNames = []; func75.definitionLine = 31; func75.definitionModule = "option"; var func82 = function(argcv) { // method last, line 32 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("last", 0, numArgs - 0); } setLineNumber(32); // compilenode member var call83 = selfRequest(this, "first", [0]); assertTypeOrMsg(call83, var_T, "result of method last", "T"); return call83; }; // end of method last func82.returnType = var_T; this.methods["last"] = func82; func82.methodName = "last"; func82.paramCounts = [0]; func82.paramNames = []; func82.definitionLine = 32; func82.definitionModule = "option"; var func84 = function(argcv) { // method reversed, line 33 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("reversed", 0, numArgs - 0); } setLineNumber(33); // compilenode member var call85 = selfRequest(var_$module, "Option", [0]); assertTypeOrMsg(this, call85, "result of method reversed", "Option"); return this; }; // end of method reversed var call86 = selfRequest(var_$module, "Option", [0]); func84.returnType = call86; this.methods["reversed"] = func84; func84.methodName = "reversed"; func84.paramCounts = [0]; func84.paramNames = []; func84.definitionLine = 33; func84.definitionModule = "option"; var func87 = function(argcv, var_target) { // method >>(_), line 34 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError(">>(_)", 0, numArgs - 1); } setLineNumber(34); // compilenode yourself // call case 4: other requests var term88 = request(var_target, "<<(1)", [1], this); return term88; }; // end of method >>(_) this.methods[">>(1)"] = func87; func87.methodName = ">>(1)"; func87.paramCounts = [1]; func87.paramNames = ["target"]; func87.definitionLine = 34; func87.definitionModule = "option"; var func89 = function(argcv, var_source) { // method <<(_), line 35 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("<<(_)", 0, numArgs - 1); } setLineNumber(35); // compilenode op // call case 4: other requests var concat90 = selfRequest(this, "++(1)", [1], var_source); return concat90; }; // end of method <<(_) this.methods["<<(1)"] = func89; func89.methodName = "<<(1)"; func89.paramCounts = [1]; func89.paramNames = ["source"]; func89.definitionLine = 35; func89.definitionModule = "option"; const overridenByAliases = { }; for (let aix = 0, aLen = aliases.length; aix < aLen; aix ++) { const a = aliases[aix]; const newNm = a.newName; const oldNm = a.oldName; overridenByAliases[newNm] = this.methods[newNm]; const m = confidentialVersion(overridenByAliases[oldNm] || this.methods[oldNm], newNm); m.definitionLine = 18; m.definitionModule = "option"; this.methods[newNm] = m; } for (let exName in inheritedExclusions) { if (inheritedExclusions.hasOwnProperty(exName)) { if (inheritedExclusions[exName]) { this.methods[exName] = inheritedExclusions[exName]; } else { delete this.methods[exName]; } } } var obj32_init = function() { // init of object on line 18 }; return obj32_init; // from compileBuildAndInitFunctions(_)inMethod(_) }; var obj32_init = obj32_build.call(inheritingObject, null, this, aliases, exclusions, var_T); return obj32_init; // from compileBuildMethodFor(_)withObjCon(_)inside(_) }; // end of method optionAsCollection$build(_,_,_) this.methods["optionAsCollection$build(3)"] = func31; func31.methodName = "optionAsCollection$build(3)"; func31.paramCounts = [0]; func31.paramNames = []; func31.typeParamNames = ["T"]; func31.definitionLine = 18; func31.definitionModule = "option"; var func91 = function(argcv, var_contents, var_T) { // method full(_), line 37 var returnTarget = invocationCount; invocationCount++; if (! var_T) var_T = type_Unknown; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 2)) { raiseTypeArgError("full(_)", 1, numArgs - 1); } assertTypeOrMsg(var_contents, var_T, "argument to request of `full(_)`", "T"); var ouc = emptyGraceObject("full(_)", "option", 37); var ouc_init = this.methods["full(1)$build(3)"].call(this, null, var_contents, ouc, [], [], var_T); ouc_init.call(ouc); setLineNumber(37); // compilenode member var call92 = selfRequest(var_$module, "Option", [0]); assertTypeOrMsg(ouc, call92, "object returned from full(_)", "Option"); return ouc; }; // end of method full(_) func91.paramTypes = (var_T) => { return [var_T]; } func91.returnType = (var_T) => { var call93 = selfRequest(var_$module, "Option", [0]); return call93; } this.methods["full(1)"] = func91; func91.methodName = "full(1)"; func91.paramCounts = [1]; func91.paramNames = ["contents"]; func91.typeParamNames = ["T"]; func91.definitionLine = 37; func91.definitionModule = "option"; var func94 = function(argcv, var_contents, inheritingObject, aliases, exclusions, var_T) { // method full(_)$build(_,_,_), line 37 var returnTarget = invocationCount; invocationCount++; if (! var_T) var_T = type_Unknown; const numArgs = arguments.length - 4; if ((numArgs > 1) && (numArgs !== 2)) { raiseTypeArgError("full(_)", 1, numArgs - 1); } assertTypeOrMsg(var_contents, var_T, "argument to request of `full(_)`", "T"); var obj95_build = function(ignore, var_contents, outerObj, aliases, exclusions, var_T) { this.closureKeys = this.closureKeys || []; this.closureKeys.push("outer_option_37"); this.outer_option_37 = outerObj; const inheritedExclusions = { }; for (var eix = 0, eLen = exclusions.length; eix < eLen; eix ++) { const exMeth = exclusions[eix]; inheritedExclusions[exMeth] = this.methods[exMeth]; }; setLineNumber(38); // reuse call var initFun96 = selfRequest(var_$module, "optionAsCollection$build(3)", [null], this, [], [], var_T); // compileReuseCall setLineNumber(39); // reuse call var initFun97 = selfRequest(var_$dialect, "equality$build(3)", [null], this, [], []); // compileReuseCall this.data.value = undefined; var reader98_value = function() { // reader method value if (this.data.value === undefined) raiseUninitializedVariable("value"); return this.data.value; }; reader98_value.isDef = true; this.methods["value"] = reader98_value; var func99 = function(argcv, var___95____95__5) { // method valueIfEmpty(_), line 41 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("valueIfEmpty(_)", 0, numArgs - 1); } setLineNumber(41); // compilenode member var call100 = selfRequest(this, "value", [0]); return call100; }; // end of method valueIfEmpty(_) this.methods["valueIfEmpty(1)"] = func99; func99.methodName = "valueIfEmpty(1)"; func99.paramCounts = [1]; func99.paramNames = ["__5"]; func99.definitionLine = 41; func99.definitionModule = "option"; var func101 = function(argcv) { // method asString, line 42 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("asString", 0, numArgs - 0); } setLineNumber(42); // compilenode string var string103 = new GraceString(")"); // call case 4: other requests var call105 = selfRequest(this, "value", [0]); // call case 4: other requests var string106 = new GraceString("option.full("); var concat104 = request(string106, "++(1)", [1], call105); var concat102 = request(concat104, "++(1)", [1], string103); return concat102; }; // end of method asString this.methods["asString"] = func101; func101.methodName = "asString"; func101.paramCounts = [0]; func101.paramNames = []; func101.definitionLine = 42; func101.definitionModule = "option"; var func107 = function(argcv) { // method first, line 43 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 0) && (numArgs !== 0)) { raiseTypeArgError("first", 0, numArgs - 0); } setLineNumber(43); // compilenode member var call108 = selfRequest(this, "value", [0]); return call108; }; // end of method first this.methods["first"] = func107; func107.methodName = "first"; func107.paramCounts = [0]; func107.paramNames = []; func107.definitionLine = 43; func107.definitionModule = "option"; var func109 = function(argcv, var_action) { // method do(_), line 44 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("do(_)", 0, numArgs - 1); } setLineNumber(44); // compilenode member var call110 = selfRequest(var_$dialect, "Function1", [0]); assertTypeOrMsg(var_action, call110, "argument to request of `do(_)`", "Function1"); var call112 = selfRequest(this, "value", [0]); // call case 4: other requests var call111 = request(var_action, "apply(1)", [1], call112); return call111; }; // end of method do(_) var call113 = selfRequest(var_$dialect, "Function1", [0]); func109.paramTypes = [call113]; var call114 = selfRequest(var_$dialect, "Done", [0]); func109.returnType = call114; this.methods["do(1)"] = func109; func109.methodName = "do(1)"; func109.paramCounts = [1]; func109.paramNames = ["action"]; func109.definitionLine = 44; func109.definitionModule = "option"; var func115 = function(argcv, var_action) { // method keysAndValuesDo(_), line 45 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("keysAndValuesDo(_)", 0, numArgs - 1); } setLineNumber(45); // compilenode member var call116 = selfRequest(var_$dialect, "Function2", [0]); assertTypeOrMsg(var_action, call116, "argument to request of `keysAndValuesDo(_)`", "Function2"); var call118 = selfRequest(this, "value", [0]); // call case 4: other requests var call117 = request(var_action, "apply(2)", [2], new GraceNum(1), call118); return call117; }; // end of method keysAndValuesDo(_) var call119 = selfRequest(var_$dialect, "Function2", [0]); func115.paramTypes = [call119]; var call120 = selfRequest(var_$dialect, "Done", [0]); func115.returnType = call120; this.methods["keysAndValuesDo(1)"] = func115; func115.methodName = "keysAndValuesDo(1)"; func115.paramCounts = [1]; func115.paramNames = ["action"]; func115.definitionLine = 45; func115.definitionModule = "option"; var func121 = function(argcv, var_v) { // method contains(_), line 46 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) {