目前我尝试用较少的东西来构建mixins,但是对我来说似乎更复杂,然后我首先考虑了。例如,我尝试构建一个if条件,我的标题如下所示:
Process: LiveCode-Community [69341]
Path: /Applications/LiveCode Community 7.0.1.app/Contents/MacOS/LiveCode-Community
Identifier: com.runrev.livecode
Version: 7.0.1.10020 [RC 2] (7.0.1.10020 [RC 2])
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: LiveCode-Community [69341]
User ID: 502
Date/Time: 2015-07-01 11:04:58.427 +0100
OS Version: Mac OS X 10.10.3 (14D136)
Report Version: 11
Anonymous UUID: F145239F-111C-2DD7-D8F5-0EA338CB5568
Sleep/Wake UUID: 40F13F91-3DAC-4E13-A409-3F01E823A448
Time Awake Since Boot: 420000 seconds
Time Since Wake: 2000 seconds
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000000001000-0000000000942000 [ 9476K] r-x/rwx SM=COW /Applications/LiveCode Community 7.0.1.app/Contents/MacOS/LiveCode-Community
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_c.dylib 0x94305920 strlen + 16
1 com.runrev.livecode 0x001b0ab8 MCObject::setname_cstring(char const*) + 40
2 com.runrev.livecode 0x0017635a MCHcbmap::build() + 1562
3 com.runrev.livecode 0x001776b3 MCHcbkgd::build(MCHcstak*, MCStack*) + 339
4 com.runrev.livecode 0x001796a4 MCHcstak::build() + 1124
5 com.runrev.livecode 0x00179ad5 hc_import(__MCString*, MCSystemFileHandle*, MCStack*&) + 277
6 com.runrev.livecode 0x00124d76 MCDispatch::doreadfile(__MCString*, __MCString*, MCSystemFileHandle*&, MCStack*&) + 2086
7 com.runrev.livecode 0x0012512d MCDispatch::loadfile(__MCString*, MCStack*&) + 493
8 com.runrev.livecode 0x0012717c MCDispatch::findstackname(__MCName*) + 188
9 com.runrev.livecode 0x0020f0f4 MCStack::findstackname_string(__MCString*) + 84
10 com.runrev.livecode 0x00104902 MCGo::findstack(MCExecContext&, __MCString*, Chunk_term, MCCard*&) + 322
11 com.runrev.livecode 0x00104b53 MCGo::exec_ctxt(MCExecContext&) + 307
12 com.runrev.livecode 0x00171689 MCHandler::exec(MCExecContext&, MCParameter*) + 1081
13 com.runrev.livecode 0x001b2ca7 MCObject::exechandler(MCHandler*, MCParameter*) + 471
14 com.runrev.livecode 0x001b3bc1 MCObject::handleself(Handler_type, __MCName*, MCParameter*) + 193
15 com.runrev.livecode 0x001b3c82 MCObject::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 50
16 com.runrev.livecode 0x002d3bf2 MCKeywordsExecCommandOrFunction(MCExecContext&, bool, MCHandler*, MCParameter*, __MCName*, unsigned short, unsigned short, bool, bool) + 866
17 com.runrev.livecode 0x00215e92 MCComref::exec_ctxt(MCExecContext&) + 98
18 com.runrev.livecode 0x002d3fc2 MCKeywordsExecuteStatements(MCExecContext&, MCStatement*, Exec_errors) + 162
19 com.runrev.livecode 0x002d4183 MCKeywordsExecuteRepeatStatements(MCExecContext&, MCStatement*, unsigned short, unsigned short, bool&) + 35
20 com.runrev.livecode 0x002d471e MCKeywordsExecRepeatFor(MCExecContext&, MCStatement*, MCExpression*, MCVarref*, File_unit, unsigned short, unsigned short) + 1246
21 com.runrev.livecode 0x0018e529 MCRepeat::exec_ctxt(MCExecContext&) + 105
22 com.runrev.livecode 0x002d3fc2 MCKeywordsExecuteStatements(MCExecContext&, MCStatement*, Exec_errors) + 162
23 com.runrev.livecode 0x002d4158 MCKeywordsExecIf(MCExecContext&, MCExpression*, MCStatement*, MCStatement*, unsigned short, unsigned short) + 88
24 com.runrev.livecode 0x0018da4c MCIf::exec_ctxt(MCExecContext&) + 60
25 com.runrev.livecode 0x00171689 MCHandler::exec(MCExecContext&, MCParameter*) + 1081
26 com.runrev.livecode 0x001b2ca7 MCObject::exechandler(MCHandler*, MCParameter*) + 471
27 com.runrev.livecode 0x001b3bc1 MCObject::handleself(Handler_type, __MCName*, MCParameter*) + 193
28 com.runrev.livecode 0x001b3c82 MCObject::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 50
29 com.runrev.livecode 0x00123c41 MCDispatch::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 353
30 com.runrev.livecode 0x00201412 MCStack::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 482
31 com.runrev.livecode 0x00201412 MCStack::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 482
32 com.runrev.livecode 0x000db72a MCCard::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 362
33 com.runrev.livecode 0x001b3cbe MCObject::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 110
34 com.runrev.livecode 0x001b3cbe MCObject::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 110
35 com.runrev.livecode 0x002d3bf2 MCKeywordsExecCommandOrFunction(MCExecContext&, bool, MCHandler*, MCParameter*, __MCName*, unsigned short, unsigned short, bool, bool) + 866
36 com.runrev.livecode 0x00215e92 MCComref::exec_ctxt(MCExecContext&) + 98
37 com.runrev.livecode 0x002d3fc2 MCKeywordsExecuteStatements(MCExecContext&, MCStatement*, Exec_errors) + 162
38 com.runrev.livecode 0x002d3ee7 MCKeywordsExecSwitch(MCExecContext&, MCExpression*, MCExpression**, unsigned int, short, unsigned short*, MCStatement*, unsigned short, unsigned short) + 567
39 com.runrev.livecode 0x0018eeaf MCSwitch::exec_ctxt(MCExecContext&) + 95
40 com.runrev.livecode 0x00171689 MCHandler::exec(MCExecContext&, MCParameter*) + 1081
41 com.runrev.livecode 0x001b2ca7 MCObject::exechandler(MCHandler*, MCParameter*) + 471
42 com.runrev.livecode 0x001b3bc1 MCObject::handleself(Handler_type, __MCName*, MCParameter*) + 193
43 com.runrev.livecode 0x001b3c82 MCObject::handle(Handler_type, __MCName*, MCParameter*, MCObject*) + 50
44 com.runrev.livecode 0x001b1911 MCObject::message(__MCName*, MCParameter*, unsigned char, unsigned char, unsigned char) + 433
45 com.runrev.livecode 0x001b1723 MCObject::message_with_valueref_args(__MCName*, void*) + 115
46 com.runrev.livecode 0x002f45e0 MCPlatformHandleMenuSelect(MCPlatformMenu*, unsigned int) + 464
47 com.runrev.livecode 0x002e00ef -[com_runrev_livecode_MCMenuDelegate menuItemSelected:] + 207
48 libobjc.A.dylib 0x9aa47853 -[NSObject performSelector:withObject:] + 70
49 com.apple.AppKit 0x938407ee __36-[NSApplication sendAction:to:from:]_block_invoke + 51
50 libsystem_trace.dylib 0x90846c03 _os_activity_initiate + 89
51 com.apple.AppKit 0x93840707 -[NSApplication sendAction:to:from:] + 602
52 com.apple.AppKit 0x938403ad -[NSMenuItem _corePerformAction] + 479
53 com.apple.AppKit 0x9384009e -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 162
54 com.apple.AppKit 0x9383f71a -[NSMenu _performActionWithHighlightingForItemAtIndex:sendAccessibilityNotification:] + 79
55 com.apple.AppKit 0x93911e3b __38-[NSMenu performActionForItemAtIndex:]_block_invoke + 52
56 libsystem_trace.dylib 0x90846c03 _os_activity_initiate + 89
57 com.apple.AppKit 0x93911dff -[NSMenu performActionForItemAtIndex:] + 141
58 com.apple.AppKit 0x93911d5e -[NSMenu _internalPerformActionForItemAtIndex:] + 45
59 com.apple.AppKit 0x93911d29 -[NSMenuItem _internalPerformActionThroughMenuIfPossible] + 106
60 com.apple.AppKit 0x93911b82 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 120
61 com.apple.AppKit 0x938270b7 NSSLMMenuEventHandler + 679
62 com.apple.HIToolbox 0x9526f5a4 _InvokeEventHandlerUPP(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*, long (*)(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*)) + 36
63 com.apple.HIToolbox 0x950ad681 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2291
64 com.apple.HIToolbox 0x950ac65c SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 402
65 com.apple.HIToolbox 0x950c0f25 SendEventToEventTarget + 88
66 com.apple.HIToolbox 0x9526f422 SendHICommandEvent(unsigned long, HICommand const*, unsigned long, unsigned long, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 447
67 com.apple.HIToolbox 0x9513327c SendMenuCommandWithContextAndModifiers + 72
68 com.apple.HIToolbox 0x95133220 SendMenuItemSelectedEvent + 207
69 com.apple.HIToolbox 0x951330db FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 145
70 com.apple.HIToolbox 0x952c1517 MenuSelectCore(MenuData*, Point, double, unsigned long, OpaqueMenuRef**, unsigned short*) + 775
71 com.apple.HIToolbox 0x9513387b _HandleMenuSelection2 + 512
72 com.apple.HIToolbox 0x95133665 _HandleMenuSelection + 55
73 com.apple.AppKit 0x937387f6 _NSHandleCarbonMenuEvent + 359
74 com.apple.AppKit 0x93667ae9 _DPSNextEvent + 1710
75 com.apple.AppKit 0x93666dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
76 com.runrev.livecode 0x002da8e9 MCPlatformWaitForEvent(double, bool) + 505
77 com.runrev.livecode 0x002f251c MCScreenDC::wait(double, unsigned char, unsigned char) + 460
78 com.runrev.livecode 0x0024568d X_main_loop_iteration() + 237
79 com.runrev.livecode 0x002f6673 MCPlatformHandleApplicationRun(bool&) + 19
80 com.runrev.livecode 0x002d9ef4 -[com_runrev_livecode_MCApplicationDelegate runMainLoop] + 84
81 com.apple.Foundation 0x95dcb166 __NSFireDelayedPerform + 489
82 com.apple.CoreFoundation 0x9148a006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
83 com.apple.CoreFoundation 0x91489ab4 __CFRunLoopDoTimer + 1316
84 com.apple.CoreFoundation 0x9150554f __CFRunLoopDoTimers + 351
85 com.apple.CoreFoundation 0x91441531 __CFRunLoopRun + 2081
86 com.apple.CoreFoundation 0x91440aa6 CFRunLoopRunSpecific + 390
87 com.apple.CoreFoundation 0x9144090b CFRunLoopRunInMode + 123
88 com.apple.HIToolbox 0x950d38f8 RunCurrentEventLoopInMode + 262
89 com.apple.HIToolbox 0x950d3503 ReceiveNextEventCommon + 192
90 com.apple.HIToolbox 0x950d342c _BlockUntilNextEventMatchingListInModeWithFilter + 99
91 com.apple.AppKit 0x93667721 _DPSNextEvent + 742
92 com.apple.AppKit 0x93666dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
93 com.apple.AppKit 0x9365b77c -[NSApplication run] + 907
94 com.runrev.livecode 0x002dd057 main + 759
95 com.runrev.livecode 0x00002925 start + 53
我知道数组的定义如下:
.ifClauses(
@checkParam,
@conditions:{
isnumber(@checkParam),
ispercentage(@checkParam),
ispixel(@checkParam)
},
@thens:{
.first(){height:@checkParam * 1px;},
.second(){height:@checkParam;},
.third(){height:@checkParam;}
}
)
也许我可以将它作为一个对象来说,当params用逗号分隔时,如何将数组写入mixins参数?
答案 0 :(得分:0)
现在我这样解决了:
.height(@param: @_tablet_slider_-height){
@active : false;
& when(isnumber(@param)){
height: @param * 1px;
@active: true;
}
& when(isunit(@param)){
height: @param;
@active: true;
}
& when(ispixel(@param)){
height: @param;
@active: true;
}
& when(isem(@param)){
height: @param;
@active: true;
}
& when(ispercentage(@param)){
height: @param;
@active: true;
}
& when(@active = false){
&:before{
content:"Error in parsing less"
}
}
}
我希望你们中的一些人可以使用它,或者有人可以使用更好的解决方案:)