Merged
Conversation
Fix for typed arrays handling Fix Box/Line instances member functions access
Fix : non computed properties access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
LineObject,LabelObject, andBoxObjectnow carry delegate setter/getter methods directly on the instance (e.g.,myLine.set_x2(x),myBox.set_right(r),myLabel.set_text(t)). Each delegate forwards to the owning helper so the plot sync (_syncToPlot) fires correctly. Enables Pine Script patterns where drawing objects stored in UDTs or arrays are mutated via method syntax.fill()): Added support for Pine Script's gradient fill signature —fill(plot1, plot2, top_value, bottom_value, top_color, bottom_color). TheFillHelperdetects the gradient form (third argument is a number) and stores per-bartop_value/bottom_value/top_color/bottom_colordata for the renderer.array<float> src,map<string, float> data). Previously these caused parse errors.Fixed
varUDT instance contains fields initialised with factory calls (e.g.,line.new(...),box.new(...)), those fields are now correctly resolved as thunks on bar 0 insideinitVar. Previously the thunk-wrapped factory results were stored as raw functions in the UDT field, causing the drawing object to never be created.inferValueType()no longer throws"Cannot infer type from value"when called with an object (e.g., aLineObjectorBoxObject). It now returnsPineArrayType.any, allowingarray<line>and similar typed arrays to work correctly.$.param(): FixedExpressionTransformerincorrectly wrapping namespace constant accesses (e.g.,label.style_label_down,line.style_dashed) in$.get()calls when they appeared inside function arguments. The transformer now detects non-computed member access onNAMESPACES_LIKEidentifiers and leaves them untransformed.histbaseType inPlotOptions: Fixed thehistbasefield in thePlotOptionsTypeScript type frombooleantonumber, matching the actual Pine Scriptplot(histbase=50)signature.MemberExpressionRecursion: Fixed user variable identifiers inside method calls inforloops (e.g.,lineMatrix.rows()) not being transformed. TheMemberExpressionvisitor intransformForStatementnow recurses into the object node after transformation so nested identifiers are correctly resolved.and/ Comparison Expressions: Fixed the Pine Script parser dropping continuation lines inand/&&chains and comparison expressions spanning multiple lines.skipNewlines(true)is now called after the operator.matrix.inv()— Full NxN Support: Rewrotematrix.inv()from a 2×2-only implementation to Gauss-Jordan elimination with partial pivoting, supporting any square matrix. Singular matrices (pivot < 1e-14) return a NaN matrix.matrix.pinv()— Real Pseudoinverse: Rewrotematrix.pinv()from a placeholder stub to a correct Moore-Penrose pseudoinverse: square →inv(), tall (m > n) →(AᵀA)⁻¹Aᵀ, wide (m < n) →Aᵀ(AAᵀ)⁻¹.array.min()/array.max()Performance: Added an O(N) fast path for the commonnth=0case instead of always sorting O(N log N).array.median(),percentile_linear_interpolation(),percentile_nearest_rank()Performance: Single-pass copy-and-validate optimizations.isPlot()with Undefined Title: FixedisPlot()to accept plot objects that have_plotKeybut notitleproperty (e.g., fill plots created via callsite ID), preventingfill()from misidentifying its arguments (contribution by @dcaoyuan, #142).mapinCONTEXT_PINE_VARS: Removed an accidental duplicate'map'entry fromsettings.ts.