Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/GuardParser.java @ 11190:4eb23800c907
Truffle-DSL: Implemented support for negated guards (GRAAL-371 #resolve)
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 31 Jul 2013 15:36:01 +0200 |
parents | 79041ab43660 |
children | efe58aa92f86 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/GuardParser.java Wed Jul 31 15:07:42 2013 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/GuardParser.java Wed Jul 31 15:36:01 2013 +0200 @@ -35,11 +35,18 @@ private final SpecializationData specialization; private final String guardName; + private final boolean negated; - public GuardParser(ProcessorContext context, SpecializationData specialization, String guardName) { + public GuardParser(ProcessorContext context, SpecializationData specialization, String guardDefinition) { super(context, specialization.getNode()); this.specialization = specialization; - this.guardName = guardName; + if (guardDefinition.startsWith("!")) { + this.guardName = guardDefinition.substring(1, guardDefinition.length()); + this.negated = true; + } else { + this.guardName = guardDefinition; + this.negated = false; + } setEmitErrors(false); setParseNullOnError(false); } @@ -71,7 +78,7 @@ @Override public GuardData create(TemplateMethod method) { - GuardData guard = new GuardData(method, specialization); + GuardData guard = new GuardData(method, specialization, negated); /* * Update parameters in way that parameter specifications match again the node field names * etc.