38 lines
1.1 KiB
ActionScript
Executable File
38 lines
1.1 KiB
ActionScript
Executable File
/*
|
|
** ADOBE SYSTEMS INCORPORATED
|
|
** Copyright 2012 Adobe Systems Incorporated
|
|
** All Rights Reserved.
|
|
**
|
|
** NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
|
|
** terms of the Adobe license agreement accompanying it. If you have received this file from a
|
|
** source other than Adobe, then your use, modification, or distribution of it requires the prior
|
|
** written permission of Adobe.
|
|
*/
|
|
package com.adobe.utils.macro
|
|
{
|
|
internal class UnaryExpression extends Expression
|
|
{
|
|
public function UnaryExpression() {}
|
|
|
|
public var right:Expression;
|
|
override public function print( depth:int ):void {
|
|
if ( AGALPreAssembler.TRACE_VM ) {
|
|
trace( spaces( depth ) + "not" );
|
|
}
|
|
right.print( depth+1 );
|
|
}
|
|
override public function exec( vm:VM ):void {
|
|
right.exec( vm );
|
|
|
|
var varRight:Number = vm.stack.pop();
|
|
var value:Number = (varRight == 0) ? 1 : 0;
|
|
|
|
if ( AGALPreAssembler.TRACE_VM ) {
|
|
trace( "::NotExpression push " + value );
|
|
}
|
|
if ( isNaN( varRight ) ) throw new Error( "UnaryExpression NaN" );
|
|
vm.stack.push( value );
|
|
}
|
|
}
|
|
}
|