redefineWithObjectArgs allow changing access public/private
This commit is contained in:
@@ -141,13 +141,27 @@ class FieldForms {
|
|||||||
throw KissError.fromExp(wholeExp, 'Function or method $field does not exist to be redefined');
|
throw KissError.fromExp(wholeExp, 'Function or method $field does not exist to be redefined');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (args[1].def) {
|
var access = originalFunction.access;
|
||||||
|
var newFieldNameExp = switch(args[1].def) {
|
||||||
|
case MetaExp("public", innerExp):
|
||||||
|
access.remove(APrivate);
|
||||||
|
access.push(APublic);
|
||||||
|
innerExp.def;
|
||||||
|
case MetaExp("private", innerExp):
|
||||||
|
access.remove(APublic);
|
||||||
|
access.push(APrivate);
|
||||||
|
innerExp.def;
|
||||||
|
case other:
|
||||||
|
other;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (newFieldNameExp) {
|
||||||
case Symbol(newFieldName):
|
case Symbol(newFieldName):
|
||||||
var newField = {
|
var newField = {
|
||||||
pos: wholeExp.macroPos(),
|
pos: wholeExp.macroPos(),
|
||||||
name: newFieldName,
|
name: newFieldName,
|
||||||
meta: originalFunction.meta,
|
meta: originalFunction.meta,
|
||||||
access: originalFunction.access,
|
access: access,
|
||||||
kind: FFun(switch(originalFunction.kind) {
|
kind: FFun(switch(originalFunction.kind) {
|
||||||
case FFun({ret: ret, params: params, args: originalArgs}):
|
case FFun({ret: ret, params: params, args: originalArgs}):
|
||||||
var argIndexMap = new Map<String,Int>();
|
var argIndexMap = new Map<String,Int>();
|
||||||
|
Reference in New Issue
Block a user