mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
turn abstractName into a property to better follow the Python API
This commit is contained in:
@@ -403,16 +403,13 @@ async function mkAPI() {
|
||||
asm.gu_pool_free(pool);
|
||||
});
|
||||
|
||||
function PGF(pgfPtr,pool) {
|
||||
function PGF(pgfPtr,name,pool) {
|
||||
this.pgfPtr = pgfPtr;
|
||||
this.abstractName = name;
|
||||
this.pool = pool;
|
||||
this.languages = {};
|
||||
registry.register(this,pool);
|
||||
}
|
||||
PGF.prototype.abstractName = function() {
|
||||
const namePtr = asm.pgf_abstract_name(this.pgfPtr);
|
||||
return UTF8ToString(namePtr);
|
||||
}
|
||||
|
||||
function Concr(pgf,name) {
|
||||
this.pgf = pgf;
|
||||
@@ -434,7 +431,10 @@ async function mkAPI() {
|
||||
throw new Error('Cannot read PGF');
|
||||
}
|
||||
|
||||
const pgf = new PGF(pgfPtr,pool);
|
||||
const namePtr = asm.pgf_abstract_name(pgfPtr);
|
||||
const abstractName = UTF8ToString(namePtr);
|
||||
|
||||
const pgf = new PGF(pgfPtr,abstractName,pool);
|
||||
|
||||
const itor = asm.gu_malloc(tmp_pool,sizeof_GuMapItor);
|
||||
const fn =
|
||||
|
||||
@@ -10,6 +10,6 @@ mkAPI().then((pgf) => {
|
||||
|
||||
pgf.readPGF("Foods.pgf").then((gr) => {
|
||||
// Print its name
|
||||
console.log(gr.abstractName());
|
||||
console.log(gr.abstractName);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user