JavaScriptMetadata.js 1.4 KB

123456789
  1. export default class JavaScriptMetadataImpl{constructor(){this._uniqueFunctions=new Map();this._instanceMethods=new Map();this._staticMethods=new Map();for(const nativeFunction of JavaScriptMetadata.NativeFunctions){if(!nativeFunction.receiver){this._uniqueFunctions.set(nativeFunction.name,nativeFunction.signatures);}else if(nativeFunction.static){if(!this._staticMethods.has(nativeFunction.receiver)){this._staticMethods.set(nativeFunction.receiver,new Map());}
  2. this._staticMethods.get(nativeFunction.receiver).set(nativeFunction.name,nativeFunction.signatures);}else{if(!this._instanceMethods.has(nativeFunction.receiver)){this._instanceMethods.set(nativeFunction.receiver,new Map());}
  3. this._instanceMethods.get(nativeFunction.receiver).set(nativeFunction.name,nativeFunction.signatures);}}}
  4. signaturesForNativeFunction(name){return this._uniqueFunctions.get(name)||null;}
  5. signaturesForInstanceMethod(name,receiverClassName){if(!this._instanceMethods.has(receiverClassName)){return null;}
  6. return this._instanceMethods.get(receiverClassName).get(name)||null;}
  7. signaturesForStaticMethod(name,receiverConstructorName){if(!this._staticMethods.has(receiverConstructorName)){return null;}
  8. return this._staticMethods.get(receiverConstructorName).get(name)||null;}}
  9. self.JavaScriptMetadata=self.JavaScriptMetadata||{};JavaScriptMetadata=JavaScriptMetadata||{};JavaScriptMetadata.JavaScriptMetadata=JavaScriptMetadataImpl;JavaScriptMetadata.NativeFunctions;