diff options
author | schinz <schinz@epfl.ch> | 2005-03-26 17:50:46 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2005-03-26 17:50:46 +0000 |
commit | a274f949c3aa9db16bd5addd0eed4f85388e74ed (patch) | |
tree | 437fff9bdb61876ccbf5fee5ef8b78ffa611f25b /sources/scalac/ast | |
parent | 9917c668018f845f55e09f74323509791063a463 (diff) | |
download | scala-a274f949c3aa9db16bd5addd0eed4f85388e74ed.tar.gz scala-a274f949c3aa9db16bd5addd0eed4f85388e74ed.tar.bz2 scala-a274f949c3aa9db16bd5addd0eed4f85388e74ed.zip |
- introduced isInstanceOf$erased and asInstance...
- introduced isInstanceOf$erased and asInstanceOf$erased methods, which
work on the erased types; things to note:
* before TypesAsValues phase, either variant can be used, although
the erased ones need to be used with caution, when speed
matters;
* after TypesAsValues phase, only the erased variants should be
used (done automatically by TreeGen);
* when run time types are disabled, the TypesAsValues phase is not
skipped anymore: it is turned into a trivial phase which
rewrites all non-erased instanceof/casts into erased ones.
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r-- | sources/scalac/ast/TreeGen.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java index 31389a3227..43d1fc1ed5 100644 --- a/sources/scalac/ast/TreeGen.java +++ b/sources/scalac/ast/TreeGen.java @@ -641,8 +641,10 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { /** Builds an instance test with given value and type. */ public Tree mkIsInstanceOf(int pos, Tree value, Type type) { - Type[] targs = new Type[]{type}; - return mkApplyT_(pos, Select(value, definitions.ANY_IS), targs); + Symbol sym = global.currentPhase.id >= global.PHASE.TYPESASVALUES.id() + ? definitions.ANY_IS_ERASED + : definitions.ANY_IS; + return mkApplyT_(pos, Select(value, sym), new Type[]{type}); } public Tree mkIsInstanceOf(Tree value, Type type) { return mkIsInstanceOf(value.pos, value, type); @@ -650,8 +652,10 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { /** Builds a cast with given value and type. */ public Tree mkAsInstanceOf(int pos, Tree value, Type type) { - Type[] targs = new Type[]{type}; - return mkApplyT_(pos, Select(value, definitions.ANY_AS), targs); + Symbol sym = global.currentPhase.id >= global.PHASE.TYPESASVALUES.id() + ? definitions.ANY_AS_ERASED + : definitions.ANY_AS; + return mkApplyT_(pos, Select(value, sym), new Type[]{type}); } public Tree mkAsInstanceOf(Tree value, Type type) { return mkAsInstanceOf(value.pos, value, type); |