mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-30 10:22:03 +00:00
Merge branch 'main' into CPTreeNode-improve-tests
This commit is contained in:
commit
6b732da749
6 files changed
+41
-7
No files matched your search
@@ -36,6 +36,7 @@
|
||||
@class CPLayoutManager
|
||||
@class CPTextContainer
|
||||
@class CPFontManager
|
||||
@class _CPFontPanelPreviewView
|
||||
|
||||
/*
|
||||
Collection indexes
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
CPParagraphStyleAttributeName = @"CPParagraphStyleAttributeName";
|
||||
|
||||
// Define missing global tab stop type constants
|
||||
@typedef CPTabStopType
|
||||
CPLeftTabStopType = 0;
|
||||
CPRightTabStopType = 1;
|
||||
CPCenterTabStopType = 2;
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
@import "CPMenuItem.j"
|
||||
|
||||
// Orientations matching AppKit standards
|
||||
// typedef enum CPRulerOrientation
|
||||
CPHorizontalRuler = 0,
|
||||
CPVerticalRuler = 1,
|
||||
CPRulerOrientationHorizontal = 0,
|
||||
CPRulerOrientationVertical = 1
|
||||
@typedef CPRulerOrientation
|
||||
CPHorizontalRuler = 0;
|
||||
CPVerticalRuler = 1;
|
||||
CPRulerOrientationHorizontal = 0;
|
||||
CPRulerOrientationVertical = 1;
|
||||
|
||||
@class CPRulerView;
|
||||
@class CPScrollView;
|
||||
|
||||
@@ -490,8 +490,11 @@
|
||||
var result = [CPMutableDictionary dictionary];
|
||||
|
||||
// Test basic for...of iteration
|
||||
for (var [key, value] of dict)
|
||||
for (var entry of dict)
|
||||
{
|
||||
var key = entry[0],
|
||||
value = entry[1];
|
||||
|
||||
[result setObject:value forKey:key];
|
||||
}
|
||||
|
||||
@@ -514,6 +517,8 @@
|
||||
var iterations = 0;
|
||||
for (var entry of emptyDict)
|
||||
{
|
||||
// Explicitly evaluate the bound variable to satisfy the static analyzer.
|
||||
[entry self];
|
||||
iterations++;
|
||||
}
|
||||
[self assert:0 equals:iterations message:@"for...of on an empty dictionary should not iterate"];
|
||||
|
||||
@@ -428,10 +428,19 @@
|
||||
|
||||
|
||||
// 3. Test on an empty set
|
||||
/*
|
||||
The bound variable must be explicitly read to satisfy the static analyzer.
|
||||
Standard JavaScript idioms for unused variables, such as the `_` identifier
|
||||
or the `void` operator, either fail linting or trigger AST collisions in the
|
||||
legacy Node.js parser. Evaluating the variable via a standard Objective-J
|
||||
message send resolves the warning while preserving parser stability.
|
||||
*/
|
||||
|
||||
var emptySet = [CPSet set];
|
||||
var iterations = 0;
|
||||
for (var entry of emptySet)
|
||||
{
|
||||
[itemsSeen addObject:entry];
|
||||
iterations++;
|
||||
}
|
||||
[self assert:0 equals:iterations message:@"for...of on an empty set should not iterate"];
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
|
||||
/*
|
||||
* NOTE: INTENTIONAL COMPILER WARNINGS
|
||||
*
|
||||
* The shadowing warnings generated by this file (e.g., "Local declaration
|
||||
* of 'ivar1' hides instance variable") are an expected artifact of the test.
|
||||
*
|
||||
* The objective of these methods is to validate the compiler's code generation
|
||||
* during a shadowing event. In standard Objective-J, unqualified instance
|
||||
* variables are transformed into explicit accessors (e.g., self.ivar1). When a
|
||||
* local variable shares the same identifier, the AST transformation must
|
||||
* intentionally suppress this behavior to maintain proper lexical scope.
|
||||
*
|
||||
* Modifying the static Objective-J declarations to avoid the warning would
|
||||
* remove the shadowing condition from the AST, fundamentally invalidating
|
||||
* the runtime verification of the compiler's output. Until explicit block-level
|
||||
* diagnostic suppression is implemented in the parser, these specific warnings
|
||||
* must be tolerated to ensure the structural integrity of the code generator.
|
||||
*/
|
||||
|
||||
@implementation IvarTestClass : CPObject
|
||||
{
|
||||
id ivar1 @accessors;
|
||||
|
||||
Reference in new issue
Block a user