structures finally look like they might be doing something
This commit is contained in:
parent
48c8d067ce
commit
570ad83371
|
@ -2096,7 +2096,6 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
|
||||||
//immutables,
|
//immutables,
|
||||||
guard);
|
guard);
|
||||||
|
|
||||||
console.log('constructor', name, superType, initFieldCount);
|
|
||||||
var constructorValue =
|
var constructorValue =
|
||||||
makePrimitiveProcedure(
|
makePrimitiveProcedure(
|
||||||
constructorName,
|
constructorName,
|
||||||
|
@ -2127,6 +2126,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
|
||||||
MACHINE.env[MACHINE.env.length - 1],
|
MACHINE.env[MACHINE.env.length - 1],
|
||||||
jsnums.toFixnum(MACHINE.env[MACHINE.env.length - 2]));
|
jsnums.toFixnum(MACHINE.env[MACHINE.env.length - 2]));
|
||||||
});
|
});
|
||||||
|
accessorValue.structType = structType;
|
||||||
|
|
||||||
var mutatorValue =
|
var mutatorValue =
|
||||||
makePrimitiveProcedure(
|
makePrimitiveProcedure(
|
||||||
|
@ -2139,6 +2139,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
|
||||||
jsnums.toFixnum(MACHINE.env[MACHINE.env.length - 2]),
|
jsnums.toFixnum(MACHINE.env[MACHINE.env.length - 2]),
|
||||||
MACHINE.env[MACHINE.env.length - 3]);
|
MACHINE.env[MACHINE.env.length - 3]);
|
||||||
});
|
});
|
||||||
|
mutatorValue.structType = structType;
|
||||||
|
|
||||||
|
|
||||||
finalizeClosureCall(MACHINE,
|
finalizeClosureCall(MACHINE,
|
||||||
|
@ -2169,7 +2170,8 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
|
||||||
makeList(2, 3),
|
makeList(2, 3),
|
||||||
function(MACHINE){
|
function(MACHINE){
|
||||||
// FIXME: typechecks
|
// FIXME: typechecks
|
||||||
var structType = MACHINE.env[MACHINE.env.length - 1];
|
// We must guarantee that the ref argument is good.
|
||||||
|
var structType = MACHINE.env[MACHINE.env.length - 1].structType;
|
||||||
var index = MACHINE.env[MACHINE.env.length - 2];
|
var index = MACHINE.env[MACHINE.env.length - 2];
|
||||||
var name;
|
var name;
|
||||||
if (MACHINE.argcount === 3) {
|
if (MACHINE.argcount === 3) {
|
||||||
|
@ -2194,7 +2196,8 @@ if(this['plt'] === undefined) { this['plt'] = {}; }
|
||||||
makeList(2, 3),
|
makeList(2, 3),
|
||||||
function(MACHINE){
|
function(MACHINE){
|
||||||
// FIXME: typechecks
|
// FIXME: typechecks
|
||||||
var structType = MACHINE.env[MACHINE.env.length - 1];
|
// We must guarantee that the set! argument is good.
|
||||||
|
var structType = MACHINE.env[MACHINE.env.length - 1].structType;
|
||||||
var index = MACHINE.env[MACHINE.env.length - 2];
|
var index = MACHINE.env[MACHINE.env.length - 2];
|
||||||
var name;
|
var name;
|
||||||
if (MACHINE.argcount === 3) {
|
if (MACHINE.argcount === 3) {
|
||||||
|
|
|
@ -10,4 +10,4 @@
|
||||||
(test "conform.rkt")
|
(test "conform.rkt")
|
||||||
(test "sk-generator.rkt")
|
(test "sk-generator.rkt")
|
||||||
(test "sk-generator-2.rkt")
|
(test "sk-generator-2.rkt")
|
||||||
#;(test "simple-structs.rkt")
|
(test "simple-structs.rkt")
|
|
@ -1,2 +1,5 @@
|
||||||
3
|
3
|
||||||
4
|
4
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang planet dyoo/whalesong
|
||||||
|
|
||||||
(define-struct p (f r))
|
(define-struct pair (f r))
|
||||||
|
(define-struct color (r g b))
|
||||||
|
|
||||||
struct:p
|
|
||||||
make-p
|
|
||||||
p-f
|
|
||||||
p-r
|
|
||||||
p?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define p1 (make-p 3 4))
|
|
||||||
(p-f p1)
|
(define p1 (make-pair 3 4))
|
||||||
(p-r p1)
|
(pair-f p1)
|
||||||
|
(pair-r p1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(color-r (make-color 3 4 5))
|
||||||
|
(color-g (make-color 3 4 5))
|
||||||
|
(color-b (make-color 3 4 5))
|
Loading…
Reference in New Issue
Block a user