aboutsummaryrefslogtreecommitdiffgithub
path: root/novice/assembler/codegen/base.ts
diff options
context:
space:
mode:
authorAustin Adams <git@austinjadams.com>2019-02-04 14:58:44 -0500
committerAustin Adams <git@austinjadams.com>2019-02-04 14:58:44 -0500
commit9958e4e7edc63e12bfa93349338347f8de9a977b (patch)
tree5a6c6f4028230eca00f3ae06e3cd34651e86c2cd /novice/assembler/codegen/base.ts
parent950ee243492e0b23feb652eff7066f17eba0a828 (diff)
downloadnovice-9958e4e7edc63e12bfa93349338347f8de9a977b.tar.gz
novice-9958e4e7edc63e12bfa93349338347f8de9a977b.tar.xz
codegen: Remove another weird unnecessary copy
Diffstat (limited to 'novice/assembler/codegen/base.ts')
-rw-r--r--novice/assembler/codegen/base.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/novice/assembler/codegen/base.ts b/novice/assembler/codegen/base.ts
index 7db24e3..ab64575 100644
--- a/novice/assembler/codegen/base.ts
+++ b/novice/assembler/codegen/base.ts
@@ -137,8 +137,9 @@ class BaseMachineCodeGenerator implements MachineCodeGenerator {
const [words, hasLabel] =
this.inflateInstr(isa, opSpec, subInstr, newPc,
symbtable);
- // TODO: unnecessary copy?
- allWords = allWords.concat(words);
+ for (const word of words) {
+ allWords.push(word);
+ }
}
return [allWords, false];
@@ -246,8 +247,6 @@ class BaseMachineCodeGenerator implements MachineCodeGenerator {
const minTwos = -maxUnsignedVal(numBits - 1) - 1;
if (field.kind === 'reg' && operand.kind === 'reg') {
- // TODO: support other prefixes etc
-
if (operand.num < 0) {
throw new Error(`negative register number ` +
`${operand.num} on line ${instr.line}`);