diff options
author | 2015-11-06 12:16:03 +0000 | |
---|---|---|
committer | 2015-11-06 16:40:00 +0000 | |
commit | 0ec13b9f03417142ca63b9fe1eb85827d6308233 (patch) | |
tree | 5350445840d49888fcebc98a28d6b9182d71c85a /src/main/java/com/google/devtools/build/lib/syntax/Statement.java | |
parent | 976f1b657bb45c5cb58d48327ce05babe9cd4cdf (diff) |
Add initial Skylark byte code generation code.
Does not yet contain any implementation for expressions and statements
but sets up various needed mechanisms and helper classes.
--
MOS_MIGRATED_REVID=107222845
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/Statement.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/Statement.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Statement.java b/src/main/java/com/google/devtools/build/lib/syntax/Statement.java index 829c4a29ab..3db9b1cdd5 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/Statement.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/Statement.java @@ -13,6 +13,13 @@ // limitations under the License. package com.google.devtools.build.lib.syntax; +import com.google.common.base.Optional; +import com.google.devtools.build.lib.syntax.compiler.DebugInfo; +import com.google.devtools.build.lib.syntax.compiler.LoopLabels; +import com.google.devtools.build.lib.syntax.compiler.VariableScope; + +import net.bytebuddy.implementation.bytecode.ByteCodeAppender; + /** * Base class for all statements nodes in the AST. */ @@ -59,4 +66,15 @@ public abstract class Statement extends ASTNode { * @throws EvalException if the Statement has a semantical error. */ abstract void validate(ValidationEnvironment env) throws EvalException; + + /** + * Builds a {@link ByteCodeAppender} that implements this statement. + * + * <p>A statement implementation should never require any particular state of the byte code + * stack and should leave it in the state it was before. + */ + ByteCodeAppender compile( + VariableScope scope, Optional<LoopLabels> loopLabels, DebugInfo debugInfo) { + throw new UnsupportedOperationException(this.getClass().getSimpleName() + " unsupported."); + } } |