Skip to content

Commit

Permalink
Merge branch 'master' into resolveSourceRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron authored Aug 23, 2024
2 parents d24e93f + 2d0f46b commit fe3bf80
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
29 changes: 25 additions & 4 deletions scripts/scrape-roku-docs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable @typescript-eslint/dot-notation */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
Expand Down Expand Up @@ -298,7 +299,7 @@ class Runner {
const arg = call.args[i];
let paramName = `param${i}`;
if (isVariableExpression(arg)) {
paramName = arg.getName(ParseMode.BrightScript)
paramName = arg.getName(ParseMode.BrightScript);
}
signature.params.push({
name: paramName,
Expand All @@ -311,7 +312,7 @@ class Runner {
component.constructors.push(signature);
}
} else if (match[1]) {
const signature = this.getConstructorSignature(name, match[1])
const signature = this.getConstructorSignature(name, match[1]);

if (signature) {
component.constructors.push(signature);
Expand All @@ -329,10 +330,30 @@ class Runner {

this.result.components[component?.name?.toLowerCase()] = component;
}
if (!this.result.components['rointrinsicdouble']) {
this.result.components['rointrinsicdouble'] = {
availableSince: undefined,
constructors: [],
description: 'roIntrinsicDouble is the object equivalent for type \'Double\'.\n\nIt is a legacy object name, corresponding to the intrinsic Double object. Applications should use Double literal values and/or Double-typed variables directly.',
events: [],
interfaces: [
{
name: 'ifDouble',
url: 'https://developer.roku.com/docs/references/brightscript/interfaces/ifdouble.md'
},
{
name: 'ifToStr',
url: 'https://developer.roku.com/docs/references/brightscript/interfaces/iftostr.md'
}
],
name: 'roIntrinsicDouble',
url: 'https://developer.roku.com/docs/references/brightscript/components/rodouble.md'
};
}
}

private getConstructorSignature(componentName: string, sourceCode: string) {
const foundParamTexts = this.findParamTexts(sourceCode)
const foundParamTexts = this.findParamTexts(sourceCode);

if (foundParamTexts && foundParamTexts[0].toLowerCase() === componentName.toLowerCase()) {
const signature = {
Expand Down Expand Up @@ -797,6 +818,7 @@ function deepSearch<T = any>(object, key, predicate): T {
return object;
}

// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < Object.keys(object).length; i++) {
let value = object[Object.keys(object)[i]];
if (typeof value === 'object' && value) {
Expand Down Expand Up @@ -1235,4 +1257,3 @@ interface ElementFilter {

//run the builder
new Runner().run().catch((e) => console.error(e));

10 changes: 10 additions & 0 deletions src/Scope.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,16 @@ describe('Scope', () => {
expectZeroDiagnostics(program);
});

it('recognizes roIntrinsicDouble', () => {
program.setFile(`source/file.brs`, `
sub main()
intrinsicDouble = CreateObject("roIntrinsicDouble")
end sub
`);
program.validate();
expectZeroDiagnostics(program);
});

it('catches invalid BrightScript components', () => {
program.setFile(`source/file.brs`, `
sub main()
Expand Down
19 changes: 18 additions & 1 deletion src/roku-types/data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"generatedDate": "2022-11-02T15:29:46.390Z",
"generatedDate": "2024-08-23T13:39:25.188Z",
"nodes": {
"animation": {
"description": "Extends [**AnimationBase**](https://developer.roku.com/docs/references/scenegraph/abstract-nodes/animationbase.md\n\nThe Animation node class provides animations of renderable nodes, by applying interpolator functions to the values in specified renderable node fields. For an animation to take effect, an Animation node definition must include a child field interpolator node ([FloatFieldInterpolator](https://developer.roku.com/docs/references/scenegraph/animation-nodes/floatfieldinterpolator.md\"FloatFieldInterpolator\"), [Vector2DFieldInterpolator](https://developer.roku.com/docs/references/scenegraph/animation-nodes/vector2dfieldinterpolator.md\"Vector2DFieldInterpolator\"), [ColorFieldInterpolator](https://developer.roku.com/docs/references/scenegraph/animation-nodes/colorfieldinterpolator.md\"ColorFieldInterpolator\")) definition for each renderable node field that is animated.\n\nThe Animation node class provides a simple linear interpolator function, where the animation takes place smoothly and simply from beginning to end. The Animation node class also provides several more complex interpolator functions to allow custom animation effects. For example, you can move a graphic image around the screen at differing speeds and curved trajectories at different times in the animation by specifying the appropriate function in the easeFunction field (quadratic and exponential are two examples of functions that can be specified). The interpolator functions are divided into two parts: the beginning of the animation (ease-in), and the end of the animation (ease-out). You can apply a specified interpolator function to either or both ease-in and ease-out, or specify no function for either or both (which is the linear function). You can also change the portion of the animation that is ease-in and ease-out to arbitrary fractional values for a quadratic interpolator function applied to both ease-in and ease-out.",
Expand Down Expand Up @@ -6682,6 +6682,23 @@
"name": "roInt",
"url": "https://developer.roku.com/docs/references/brightscript/components/roint.md"
},
"rointrinsicdouble": {
"constructors": [],
"description": "roIntrinsicDouble is the object equivalent for type 'Double'.\n\nIt is a legacy object name, corresponding to the intrinsic Double object. Applications should use Double literal values and/or Double-typed variables directly.",
"events": [],
"interfaces": [
{
"name": "ifDouble",
"url": "https://developer.roku.com/docs/references/brightscript/interfaces/ifdouble.md"
},
{
"name": "ifToStr",
"url": "https://developer.roku.com/docs/references/brightscript/interfaces/iftostr.md"
}
],
"name": "roIntrinsicDouble",
"url": "https://developer.roku.com/docs/references/brightscript/components/rodouble.md"
},
"roinvalid": {
"constructors": [],
"description": "roInvalid is the object equivalent for intrinsic type 'Invalid'.",
Expand Down

0 comments on commit fe3bf80

Please sign in to comment.