mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:39:25 +02:00
* Patch from Mattias Gaertner with various improvements:
+ changed varname/funcname properties to string, saving many conversion + array of record + pass by reference - pass local var to a var/out parameter - pass variable to a var/out parameter - pass reference to a var/out parameter - pass array element to a var/out parameter + proc types - implemented as immutable wrapper function - assign := nil, proctype (not clone), @function, @method - call explicit and implicit - compare equal and notequal with nil, proctype, address, function - assigned(proctype) - pass as argument - methods - mode delphi: proctype:=proc - mode delphi: functype=funcresulttype + class-of - assign := nil, var - call class method - call constructor - operators =, <> - class var, property, method - Self in class method - typecast git-svn-id: trunk@35472 -
This commit is contained in:
parent
f022fdc848
commit
2d36af85bb
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
21
utils/pas2js/dist/rtl.js
vendored
21
utils/pas2js/dist/rtl.js
vendored
@ -157,11 +157,24 @@ var rtl = {
|
||||
},
|
||||
|
||||
createCallback: function(scope, fn){
|
||||
var wrapper = function(){
|
||||
var cb = function(){
|
||||
return fn.apply(scope,arguments);
|
||||
};
|
||||
wrapper.fn = fn;
|
||||
return wrapper;
|
||||
cb.fn = fn;
|
||||
cb.scope = scope;
|
||||
return cb;
|
||||
},
|
||||
|
||||
cloneCallback: function(cb){
|
||||
return rtl.createCallback(cb.scope,cb.fn);
|
||||
},
|
||||
|
||||
eqCallback: function(a,b){
|
||||
if (a==null){
|
||||
return (b==null);
|
||||
} else {
|
||||
return (b!=null) && (a.scope==b.scope) && (a.fn==b.fn);
|
||||
}
|
||||
},
|
||||
|
||||
createClass: function(owner,name,ancestor,initfn){
|
||||
@ -205,6 +218,8 @@ var rtl = {
|
||||
arr.length = newlength;
|
||||
if (rtl.isArray(defaultvalue)){
|
||||
for (var i=oldlen; i<newlength; i++) arr[i]=[]; // new array
|
||||
} else if (rtl.isFunction(defaultvalue)){
|
||||
for (var i=oldlen; i<newlength; i++) arr[i]=new defaultvalue(); // new record
|
||||
} else {
|
||||
for (var i=oldlen; i<newlength; i++) arr[i]=defaultvalue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user