Change 20101212-bargull-vK5 by barg...@bargull02 on 2010-12-12 00:31:01
in /home/anba/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: improved compile-time evaluator
New Features: LPP-9583 (Extend compile-time evaluator to support and-,
or-, not-expressions, equality tests and literals)
Bugs Fixed: LPP-9582 (ClassCastException in
CommonGenerator.evaluateCompileTimeConditional())
Technical Reviewer: ptw
QA Reviewer: hqm
Doc Reviewer: (pending)
Documentation:
Release Notes:
Overview:
New compile-time evaluator to handle and-, or-, not-expressions,
equality tests and literals
Details:
CommonGenerator:
The previous code did only handle compile-time boolean constants, like
"$dhtml" or "$as3". This code is now replaced and simply calls the newly
added evaluator.
EmptyParserVisitor:
An empty ParserVisitor which returns "null" for every visit() method.
Having this class makes it easier to concentrate on the important (=
implemented) visit() methods in CompileTimeEvaluator.
CompileTimeEvaluator:
Extended compile-time evaluator, in addition to handle compile-time
boolean constants, the new evaluator is able to compute:
- any compile-time constant
- constant literals (null, string, boolean, number)
- logical AND, logical OR, logical NOT
- equality comparisons (==, !=, ===, !==)
- conditional expressions
The implementation is relatively straight-forward and follows the
algorithms descripted in ECMAScript 3rd edition reference. Basically
every visit() method returns an instance of the internal "JSType" class,
unless it's not possible to infer the proper type (and its value) at
compile time, in that case `null` is returned.
Tests:
- attached junit test case
- compiled lfc x (dhtml,swf8,swf10)
- smokecheck x (dhtml,swf8,swf10)
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/CompileTimeEvaluator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/CompileTimeEvaluator_Test.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/EmptyParserVisitor.java
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/20101212-bargull-vK5.tar