Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Stub in the binder.
Doesn't actually do anything yet, this just gets the op and some of the constants in place.
- Loading branch information
Showing
3 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| package org.perl6.rakudo; | ||
|
|
||
| import java.util.*; | ||
|
|
||
| import org.perl6.nqp.runtime.*; | ||
| import org.perl6.nqp.sixmodel.*; | ||
|
|
||
| public final class Binder { | ||
| /* Possible results of binding. */ | ||
| public static final int BIND_RESULT_OK = 0; | ||
| public static final int BIND_RESULT_FAIL = 1; | ||
| public static final int BIND_RESULT_JUNCTION = 2; | ||
|
|
||
| /* Compile time trial binding result indicators. */ | ||
| public static final int TRIAL_BIND_NOT_SURE = 0; /* Plausible, but need to check at runtime. */ | ||
| public static final int TRIAL_BIND_OK = 1; /* Bind will always work out. */ | ||
| public static final int TRIAL_BIND_NO_WAY = -1; /* Bind could never work out. */ | ||
|
|
||
| /* Flags. */ | ||
| private static final int SIG_ELEM_BIND_CAPTURE = 1; | ||
| private static final int SIG_ELEM_BIND_PRIVATE_ATTR = 2; | ||
| private static final int SIG_ELEM_BIND_PUBLIC_ATTR = 4; | ||
| private static final int SIG_ELEM_BIND_ATTRIBUTIVE = (SIG_ELEM_BIND_PRIVATE_ATTR | SIG_ELEM_BIND_PUBLIC_ATTR); | ||
| private static final int SIG_ELEM_SLURPY_POS = 8; | ||
| private static final int SIG_ELEM_SLURPY_NAMED = 16; | ||
| private static final int SIG_ELEM_SLURPY_LOL = 32; | ||
| private static final int SIG_ELEM_SLURPY = (SIG_ELEM_SLURPY_POS | SIG_ELEM_SLURPY_NAMED | SIG_ELEM_SLURPY_LOL); | ||
| private static final int SIG_ELEM_INVOCANT = 64; | ||
| private static final int SIG_ELEM_MULTI_INVOCANT = 128; | ||
| private static final int SIG_ELEM_IS_RW = 256; | ||
| private static final int SIG_ELEM_IS_COPY = 512; | ||
| private static final int SIG_ELEM_IS_PARCEL = 1024; | ||
| private static final int SIG_ELEM_IS_OPTIONAL = 2048; | ||
| private static final int SIG_ELEM_ARRAY_SIGIL = 4096; | ||
| private static final int SIG_ELEM_HASH_SIGIL = 8192; | ||
| private static final int SIG_ELEM_DEFAULT_FROM_OUTER = 16384; | ||
| private static final int SIG_ELEM_IS_CAPTURE = 32768; | ||
| private static final int SIG_ELEM_UNDEFINED_ONLY = 65536; | ||
| private static final int SIG_ELEM_DEFINED_ONLY = 131072; | ||
| private static final int SIG_ELEM_DEFINEDNES_CHECK = (SIG_ELEM_UNDEFINED_ONLY | SIG_ELEM_DEFINED_ONLY); | ||
| private static final int SIG_ELEM_NOMINAL_GENERIC = 524288; | ||
| private static final int SIG_ELEM_DEFAULT_IS_LITERAL = 1048576; | ||
| private static final int SIG_ELEM_NATIVE_INT_VALUE = 2097152; | ||
| private static final int SIG_ELEM_NATIVE_NUM_VALUE = 4194304; | ||
| private static final int SIG_ELEM_NATIVE_STR_VALUE = 8388608; | ||
| private static final int SIG_ELEM_NATIVE_VALUE = (SIG_ELEM_NATIVE_INT_VALUE | SIG_ELEM_NATIVE_NUM_VALUE | SIG_ELEM_NATIVE_STR_VALUE); | ||
|
|
||
| /* Last error, per thread. */ | ||
| public static HashMap<ThreadContext, String> lastErrors = new HashMap<ThreadContext, String>(); | ||
|
|
||
| public static int bind(ThreadContext tc, CallFrame ctx, SixModelObject params, | ||
| CallSiteDescriptor csd, Object[] args, | ||
| boolean noNomTypeCheck, boolean needError) { | ||
| /* XXX TODO. */ | ||
| System.err.println("p6bindsig NYI"); | ||
| return BIND_RESULT_OK; | ||
| } | ||
|
|
||
| public static String lastError(ThreadContext tc) { | ||
| return lastErrors.get(tc); | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters